24 Ranges library [ranges]

24.3 Range access [range.access]

24.3.1 ranges​::​begin [range.access.begin]

The name ranges​::​begin denotes a customization point object ([customization.point.object]).
Given a subexpression E and an lvalue t that denotes the same object as E, if E is an rvalue and enable_­safe_­range<remove_­cvref_­t<decltype((E))>> is false, ranges​::​begin(E) is ill-formed.
Otherwise, ranges​::​begin(E) is expression-equivalent to:
  • t + 0 if t is of array type ([basic.compound]).
  • Otherwise, decay-copy(t.begin()) if it is a valid expression and its type I models input_­or_­output_­iterator.
  • Otherwise, decay-copy(begin(t)) if it is a valid expression and its type I models input_­or_­output_­iterator with overload resolution performed in a context that includes the declarations:
    template<class T> void begin(T&&) = delete;
    template<class T> void begin(initializer_list<T>&&) = delete;
    and does not include a declaration of ranges​::​begin.
  • Otherwise, ranges​::​begin(E) is ill-formed.
    : This case can result in substitution failure when ranges​::​begin(E) appears in the immediate context of a template instantiation. — end note
Whenever ranges​::​begin(E) is a valid expression, its type models input_­or_­output_­iterator.
— end note