10 Ranges library [ranges]

10.4 Range access [range.access]

10.4.2 end [range.access.end]

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

  • ranges::end(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::end(E) behaves similarly to std::end(E) as defined in ISO/IEC 14882 when E is an rvalue.  — end note ]

  • Otherwise, (E) + extent<T>::value if E has array type ( ISO/IEC 14882:2014 §[basic.compound]) T.

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

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

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

Note: Whenever ranges::end(E) is a valid expression, the types of ranges::end(E) and ranges::begin(E) satisfy Sentinel.  — end note ]