24 Ranges library [ranges]

24.3 Range access [range.access]

24.3.6 ranges​::​rend [range.access.rend]

The name ranges​::​rend denotes a customization point object ([customization.point.object]).
Given a subexpression E and an lvalue t that denotes the same object as E, if E is an rvalue and enable_­safe_­range<remove_­cvref_­t<decltype((E))>> is false, ranges​::​rend(E) is ill-formed.
Otherwise, ranges​::​rend(E) is expression-equivalent to:
  • decay-copy(t.rend()) if it is a valid expression and its type S models
    sentinel_for<decltype(ranges::rbegin(E))>
      
  • Otherwise, decay-copy(rend(t)) if it is a valid expression and its type S models
    sentinel_for<decltype(ranges::rbegin(E))>
      
    with overload resolution performed in a context that includes the declaration:
    template<class T> void rend(T&&) = delete;
      
    and does not include a declaration of ranges​::​rend.
  • Otherwise, make_­reverse_­iterator(ranges​::​begin(t)) if both ranges​::​begin(t) and ranges​::​​end(t) are valid expressions of the same type I which models bidirectional_­iterator ([iterator.concept.bidir]).
  • Otherwise, ranges​::​rend(E) is ill-formed.
    Note
    : This case can result in substitution failure when ranges​::​rend(E) appears in the immediate context of a template instantiation. — end note
     ]
Note
:
Whenever ranges​::​rend(E) is a valid expression, the types S and I of ranges​::​rend(E) and ranges​::​rbegin(E) model sentinel_­for<S, I>.
— end note
 ]