[range.adaptors.general]

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

## 25.7 Range adaptors [[range.adaptors]](range.adaptors#general)

### 25.7.1 General [range.adaptors.general]

[1](#1)

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

Subclause [[range.adaptors]](range.adaptors "25.7 Range adaptors") defines [*range adaptors*](#def:range_adaptors), which are utilities that transform a
range into a view with custom behaviors[.](#1.sentence-1)

These
adaptors can be chained to create pipelines of range transformations that
evaluate lazily as the resulting view is iterated[.](#1.sentence-2)

[2](#2)

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

Range adaptors are declared in namespace std​::​ranges​::​views[.](#2.sentence-1)

[3](#3)

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

The bitwise or operator is overloaded for the purpose of creating adaptor chain
pipelines[.](#3.sentence-1)

The adaptors also support function call syntax with equivalent
semantics[.](#3.sentence-2)

[4](#4)

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

[*Example [1](#example-1)*: vector<int> ints{0,1,2,3,4,5};auto even = [](int i) { return 0 == i % 2; };auto square = [](int i) { return i * i; };for (int i : ints | views::filter(even) | views::transform(square)) { cout << i << ' '; // prints 0 4 16} assert(ranges::equal(ints | views::filter(even), views::filter(ints, even))); â *end example*]
