10 Ranges library [ranges]

10.4 Range access [range.access]

10.4.1 begin [range.access.begin]

The name begin denotes a customization point object ([customization.point.object]). The expression ranges::begin(E) for some subexpression E is expression-equivalent to:

  • ranges::begin(static_cast<const T&>(E)) if E is an rvalue of type T. This usage is deprecated. [ Note: This deprecated usage exists so that ranges::begin(E) behaves similarly to std::begin(E) as defined in ISO/IEC 14882 when E is an rvalue.  — end note ]

  • Otherwise, (E) + 0 if E has array type ( ISO/IEC 14882:2014 §[basic.compound]).

  • Otherwise, DECAY_COPY((E).begin()) if it is a valid expression and its type I meets the syntactic requirements of Iterator<I>. If Iterator is not satisfied, the program is ill-formed with no diagnostic required.

  • Otherwise, DECAY_COPY(begin(E)) if it is a valid expression and its type I meets the syntactic requirements of Iterator<I> with overload resolution performed in a context that includes the declaration void begin(auto&) = delete; and does not include a declaration of ranges::begin. If Iterator is not satisfied, the program is ill-formed with no diagnostic required.

  • Otherwise, ranges::begin(E) is ill-formed.

Note: Whenever ranges::begin(E) is a valid expression, its type satisfies Iterator.  — end note ]