[range.adjacent.transform.overview]

# 25 Ranges library [[ranges]](./#ranges)

## 25.7 Range adaptors [[range.adaptors]](range.adaptors#range.adjacent.transform.overview)

### 25.7.28 Adjacent transform view [[range.adjacent.transform]](range.adjacent.transform#overview)

#### 25.7.28.1 Overview [range.adjacent.transform.overview]

[1](#1)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L13226)

adjacent_transform_view takes an invocable object and
a view and produces a view
whose Mth element is the result of applying the invocable object
to the Mth through (M+Nâ1)th elements
of the original view[.](#1.sentence-1)

If the original view has fewer than N elements, the resulting view is empty[.](#1.sentence-2)

[2](#2)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L13234)

The name views​::​adjacent_transform<N> denotes
a range adaptor object ([[range.adaptor.object]](range.adaptor.object "25.7.2 Range adaptor objects"))[.](#2.sentence-1)

Given subexpressions E and F and
a constant expression N:

- [(2.1)](#2.1)

  If N is equal to 0 anddecltype((E)) models [forward_range](range.refinements#concept:forward_range "25.4.6 Other range refinements [range.refinements]"),views​::​adjacent_transform<N>(E, F) is expression-equivalent to((void)E, views​::​zip_transform(F)),
except that the evaluations of E and F are
indeterminately sequenced[.](#2.1.sentence-1)

- [(2.2)](#2.2)

  Otherwise,
the expression views​::​adjacent_transform<N>(E, F) is
expression-equivalent toadjacent_transform_view<views​::​all_t<decltype((E))>, decay_t<decltype((F))>, N>(E, F)[.](#2.2.sentence-1)

[3](#3)

[#](http://github.com/Eelis/draft/tree/9adde4bc1c62ec234483e63ea3b70a59724c745a/source/ranges.tex#L13255)

[*Example [1](#example-1)*: vector v = {1, 2, 3, 4};

for (auto i : v | views::adjacent_transform<2>(std::multiplies())) { cout << i << ' '; // prints 2 6 12} â *end example*]
