Files
2025-10-25 03:02:53 +03:00

3.3 KiB
Raw Permalink Blame History

[range.access.rend]

25 Ranges library [ranges]

25.3 Range access [range.access]

25.3.7 ranges::rend [range.access.rend]

1

#

The name ranges::rend denotes a customization point object ([customization.point.object]).

2

#

Given a subexpression E with type T, let t be an lvalue that denotes the reified object for E.

Then:

  • (2.1)

    If E is an rvalue and enable_borrowed_range<remove_cv_t> is false, ranges::rend(E) is ill-formed.

  • (2.2)

    Otherwise, if T is an array type ([dcl.array]) and remove_all_extents_t is an incomplete type, ranges::rend(E) is ill-formed with no diagnostic required.

  • (2.3)

    Otherwise, if auto(t.rend()) is a valid expression whose type models sentinel_for<decltype(ranges::rbegin(E))> then ranges::rend(E) is expression-equivalent to auto(t.rend()).

  • (2.4)

    Otherwise, if T is a class or enumeration type and auto(rend(t)) is a valid expression whose type models sentinel_for<decltype(ranges::rbegin(E))> where the meaning of rend is established as-if by performing argument-dependent lookup only ([basic.lookup.argdep]), then ranges::rend(E) is expression-equivalent to that expression.

  • (2.5)

    Otherwise, if both ranges::begin(t) and ranges::end(t) are valid expressions of the same type which models bidirectional_iterator ([iterator.concept.bidir]), then ranges::rend(E) is expression-equivalent to make_reverse_iterator(ranges::begin(t)).

  • (2.6)

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

3

#

[Note 1:

Diagnosable ill-formed cases above result in substitution failure when ranges::rend(E) appears in the immediate context of a template instantiation.

— end note]

4

#

[Note 2:

Whenever ranges::rend(E) is a valid expression, the types S and I of the expressionsranges::rend(E) and ranges::rbegin(E) model sentinel_for<S, I>.

— end note]