cpp/ranges

The ranges library is an extension and generalization of the algorithms and iterator libraries that makes them more powerful by making them composable and less error-prone.

The library creates and manipulates range views, lightweight objects that indirectly represent iterable sequences (ranges). Ranges are an abstraction on top of
 * [begin, end) iterator pairs, e.g. ranges made by implicit conversion from containers. All algorithms that take iterator pairs now have overloads that accept ranges (e.g. )
 * [start, size) counted sequences, e.g. range returned by
 * [start, predicate) conditionally-terminated sequences, e.g. range returned by
 * [start..) unbounded sequences, e.g. range returned by

The ranges library includes range algorithms, which are applied to ranges eagerly, and range adaptors, which are applied to views lazily. Adaptors can be composed into pipelines, so that their actions take place as the view is iterated.

The namespace alias is provided as a shorthand for.

Range adaptor objects
See (RAO).

Range adaptor closure objects
See (RACO).

Customization point objects
See (CPO).

Assignable wrapper
Some range adaptors wrap their elements or function objects with the. The wrapper auguments the wrapped object with assignability when needed.

Non-propagating cache
Some range adaptors are specified in terms of an exposition-only class template, which behaves almost exactly like (see description for differences).

Range adaptor helpers
Some range adaptors are specified in terms of these exposition-only function templates.

@1@ returns a new tuple constructed by applying  to each element of. @2@ applies  to each element of  and returns nothing. @3@ forwards rvalue  as lvalue.

Helper concepts
Following exposition-only concepts are used for several types, but they are not parts of the interface of standard library.