24 Ranges library [ranges]

24.3 Range access [range.access]

24.3.3 ranges​::​end [range.access.end]

The name ranges​::​end denotes a customization point object ([customization.point.object]).
Given a subexpression E with type T, let t be an lvalue that denotes the reified object for E.
Then:
  • If E is an rvalue and enable_­borrowed_­range<remove_­cv_­t<T>> is false, ranges​::​end(E) is ill-formed.
  • Otherwise, if T is an array type ([basic.compound]) and remove_­all_­extents_­t<T> is an incomplete type, ranges​::​end(E) is ill-formed with no diagnostic required.
  • Otherwise, if T is an array of unknown bound, ranges​::​end(E) is ill-formed.
  • Otherwise, if T is an array, ranges​::​end(E) is expression-equivalent to t + extent_­v<T>.
  • Otherwise, if auto(t.end()) is a valid expression whose type models sentinel_­for<iterator_­t<T>> then ranges​::​end(E) is expression-equivalent to auto(t.end()).
  • Otherwise, if T is a class or enumeration type and auto(end(t)) is a valid expression whose type models sentinel_­for<iterator_­t<T>> with overload resolution performed in a context in which unqualified lookup for end finds only the declarations void end(auto&) = delete; void end(const auto&) = delete; then ranges​::​end(E) is expression-equivalent to auto(end(t)) with overload resolution performed in the above context.
  • Otherwise, ranges​::​end(E) is ill-formed.
[Note 1:
Diagnosable ill-formed cases above result in substitution failure when ranges​::​end(E) appears in the immediate context of a template instantiation.
— end note]
[Note 2:
Whenever ranges​::​end(E) is a valid expression, the types S and I of ranges​::​end(E) and ranges​::​begin(E) model sentinel_­for<S, I>.
— end note]