[range.reverse.overview] (original) (raw)
25 Ranges library [ranges]
25.7 Range adaptors [range.adaptors]
25.7.21 Reverse view [range.reverse]
25.7.21.1 Overview [range.reverse.overview]
reverse_view takes a bidirectional view and produces another view that iterates the same elements in reverse order.
Given a subexpression E, the expressionviews::reverse(E) is expression-equivalent to:
- If the type of E is a (possibly cv-qualified) specialization of reverse_view, then E.base().
- Otherwise, if the type of E is cv subrange<reverse_iterator<I>, reverse_iterator<I>, K> for some iterator type I and value K of type subrange_kind,
- Otherwise, reverse_view{E}.
[Example 1: vector<int> is {0,1,2,3,4};for (int i : is | views::reverse) cout << i << ' '; — _end example_]