24 Ranges library [ranges]

24.3 Range access [range.access]

24.3.5 ranges​::​rbegin [range.access.rbegin]

The name ranges​::​rbegin 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​::​rbegin(E) is ill-formed.
Otherwise, ranges​::​rbegin(E) is expression-equivalent to:
  • decay-copy(t.rbegin()) if it is a valid expression and its type I models input_­or_­output_­iterator.
  • Otherwise, decay-copy(rbegin(t)) if it is a valid expression and its type I models input_­or_­output_­iterator with overload resolution performed in a context that includes the declaration:
    template<class T> void rbegin(T&&) = delete;
    and does not include a declaration of ranges​::​rbegin.
  • Otherwise, make_­reverse_­iterator(ranges​::​end(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​::​rbegin(E) is ill-formed.
    : This case can result in substitution failure when ranges​::​rbegin(E) appears in the immediate context of a template instantiation. — end note
Whenever ranges​::​rbegin(E) is a valid expression, its type models input_­or_­output_­iterator.
— end note