3.0 KiB
[range.access.end]
25 Ranges library [ranges]
25.3 Range access [range.access]
25.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> is false, ranges::end(E) is ill-formed.
-
Otherwise, if T is an array type ([dcl.array]) and remove_all_extents_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.
-
Otherwise, if auto(t.end()) is a valid expression whose type models sentinel_for<iterator_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> where the meaning of end is established as-if by performing argument-dependent lookup only ([basic.lookup.argdep]), then ranges::end(E) is expression-equivalent to that expression.
-
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 ofranges::end(E) and ranges::begin(E) model sentinel_for<S, I>.
â end note]