[range.adjacent.overview] (original) (raw)

25 Ranges library [ranges]

25.7 Range adaptors [range.adaptors]

25.7.27 Adjacent view [range.adjacent]

25.7.27.1 Overview [range.adjacent.overview]

adjacent_view takes a view and produces a view whose element is a tuple of references to the through elements of the original view.

If the original view has fewer than N elements, the resulting view is empty.

Given a subexpression E and a constant expression N, the expression views​::​adjacent<N>(E) is expression-equivalent to

[Example 1: vector v = {1, 2, 3, 4};for (auto i : v | views::adjacent<2>) { cout << "(" << std::get<0>(i) << ", " << std::get<1>(i) << ") "; } — _end example_]

Define REPEAT(T, N) as a pack of N types, each of which denotes the same type as T.