Extensions for ranges
From cppreference.com
< cpp | experimental
The C++ Extensions for Ranges, ISO/IEC TS 21425:2017, specifies one modification to the core language and defines new components for the C++ standard library listed on this page.
The Ranges TS is based on the C++14 standard as modified by the Concepts TS.
Contents |
[edit] Core language changes
The Ranges TS modifies the specification of the range-based for loop to permit differently typed begin and end iterators. This change permits the use of sentinels and is also present in C++17.
[edit] Concepts
Core language concepts | |
Defined in header
<experimental/ranges/concepts> | |
Defined in namespace
std::experimental::ranges | |
specifies that a type is the same as another type (concept) | |
specifies that a type is derived from another type (concept) | |
specifies that a type is implicitly convertible to another type (concept) | |
specifies that two types share a common reference type (concept) | |
specifies that two types share a common type (concept) | |
specifies that a type is an integral type (concept) | |
specifies that a type is an integral type that is signed (concept) | |
specifies that a type is an integral type that is not signed (concept) | |
specifies that a type is assignable from another type (concept) | |
specifies that a type can be swapped or that two types can be swapped with each other (concept) | |
Comparison concepts | |
Defined in header
<experimental/ranges/concepts> | |
Defined in namespace
std::experimental::ranges | |
specifies that a type can be used in Boolean contexts (concept) | |
specifies that two types can be compared for equality using operators == and != (concept) | |
specifies that operator == is an equivalence relation (concept) | |
specifies that the comparison operators on the type yield a total order (concept) | |
Object concepts | |
Defined in header
<experimental/ranges/concepts> | |
Defined in namespace
std::experimental::ranges | |
specifies that an object of the type can be destroyed (concept) | |
specifies that a variable of the type can be constructed from or bound to a set of argument types (concept) | |
specifies that an object of a type can be default constructed (concept) | |
specifies that an object of a type can be move constructed (concept) | |
specifies that an object of a type can be copy constructed and move constructed (concept) | |
specifies that an object of a type can be moved and swapped (concept) | |
specifies that an object of a type can be copied, moved, and swapped (concept) | |
specifies that an object of a type can be copied, moved, swapped, and default constructed (concept) | |
specifies that a type is regular, that is, it is both Semiregular and EqualityComparable (concept) | |
Callable concepts | |
Defined in header
<experimental/ranges/concepts> | |
Defined in namespace
std::experimental::ranges | |
specifies that a callable type can be invoked with a given set of argument types (concept) | |
specifies that a callable type is a Boolean predicate (concept) | |
specifies that a callable type is a binary relation (concept) | |
specifies that a Relation imposes a strict weak ordering (concept) | |
Random number generator concept | |
Defined in header
<experimental/ranges/random> | |
Defined in namespace
std::experimental::ranges | |
specifies that a type qualifies as a uniform random number generator (concept) |
[edit] General utilities
Utility components | |
Defined in header
<experimental/ranges/utility> | |
Defined in namespace
std::experimental::ranges | |
swaps the value of two objects (customization point object) | |
replaces the argument with a new value and returns its previous value (function template) | |
Function objects | |
Defined in header
<experimental/ranges/functional> | |
Defined in namespace
std::experimental::ranges | |
invokes a Callable object with the given arguments (function template) | |
function object implementing x == y (class template) | |
function object implementing x != y (class template) | |
function object implementing x > y (class template) | |
function object implementing x < y (class template) | |
function object implementing x >= y (class template) | |
function object implementing x <= y (class template) | |
function object that returns its argument unchanged (class) | |
Metaprogramming and type traits | |
Defined in header
<experimental/ranges/type_traits> | |
Defined in namespace
std::experimental::ranges | |
checks if objects of a type can be swapped with objects of same or different type (class template) | |
determine the common reference type of a set of types (class template) | |
determine the common type of a set of types (class template) | |
Tagged pairs and tuples | |
Defined in header
<experimental/ranges/utility> | |
Defined in namespace
std::experimental::ranges | |
specifies that a type is a tag specifier (concept) | |
specifies that a type represents a tag specifier and its element type (concept) | |
augument a tuple-like type with named accessors (class template) | |
alias template for a tagged std::pair (alias template) | |
convenience function for creating a tagged_pair (function template) | |
Defined in header
<experimental/ranges/tuple> | |
alias template for a tagged std::tuple (alias template) | |
convenience function for creating a tagged_tuple (function template) | |
Defined in header
<experimental/ranges/algorithm> | |
Defined in namespace
std::experimental::ranges::tag | |
tag specifiers for use with ranges::tagged (class) |
[edit] Iterators
Defined in header
<experimental/ranges/iterator> | |
| |
Defined in namespace
std::experimental::ranges | |
Iterator concepts | |
specifies that a type is readable by applying operator * (concept) | |
specifies that a value can be written to an iterator's referenced object (concept) | |
specifies that a Semiregular type can be incremented with pre- and post-increment operators (concept) | |
specifies that the increment operation on a WeaklyIncrementable type is equality-preserving and that the type is EqualityComparable (concept) | |
specifies that objects of a type can be incremented and dereferenced (concept) | |
specifies that objects of a type is a sentinel for an Iterator type (concept) | |
specifies that the - operator can be applied to an iterator and a sentinel to calculate their difference in constant time (concept) | |
specifies that a type is an input iterator, that is, its referenced values can be read and it can be both pre- and post-incremented (concept) | |
specifies that a type is an output iterator for a given value type, that is, values of that type can be written to it and it can be both pre- and post-incremented (concept) | |
specifies that an InputIterator is a forward iterator, supporting equality comparison and multi-pass (concept) | |
specifies that a ForwardIterator is a bidirectional iterator, supporting movement backwards (concept) | |
specifies that a BidirectionalIterator is a random-access iterator, supporting advancement in constant time and subscripting (concept) | |
Indirect callable concepts | |
specifies that a callable type can be invoked with the result of dereferencing a Readable type (concept) | |
specifies that a callable object, when invoked with the result of dereferencing a Readable type, satisfies Predicate (concept) | |
specifies that a callable object, when invoked with the result of dereferencing some Readable types, satisfies Relation (concept) | |
specifies that a callable object, when invoked with the result of dereferencing some Readable types, satisfies StrictWeakOrder (concept) | |
Common algorithm requirements | |
specifies that values may be moved from a Readable type to a Writable type (concept) | |
specifies that values may be moved from a Readable type to a Writable type and that the move may be performed via an intermediate object (concept) | |
specifies that values may be copied from a Readable type to a Writable type (concept) | |
specifies that values may be copied from a Readable type to a Writable type and that the copy may be performed via an intermediate object (concept) | |
specifies that the values referenced by two Readable types can be swapped (concept) | |
specifies that the values referenced by two Readable types can be compared (concept) | |
specifies the common requirements of algorithms that reorder elements in place (concept) | |
specifies the requirements of algorithms that merge sorted sequences into an output sequence by copying elements (concept) | |
specifies the common requirements of algorithms that permute sequences into ordered sequences (concept) | |
Concept utilities | |
compute the result of invoking a callable object on the result of dereferencing some set of Readable types (class template) | |
helper template for specifying the constraints on algorithms that accept projections (class template) | |
Iterator primitives | |
Iterator utilities | |
Defined in namespace
std::experimental::ranges | |
casts the result of dereferencing an object to its associated rvalue reference type (customization point object) | |
swap the values referenced by two dereferenceable objects (customization point object) | |
Iterator traits | |
Defined in namespace
std::experimental::ranges | |
obtains the difference type of a WeaklyIncrementable type (class template) | |
obtains the value type of a Readable type (class template) | |
obtains the iterator category of an input iterator type (class template) | |
compatibility traits class that collects an iterator’s associated types (alias template) | |
obtains a dereferenceable object's associated reference types (alias template) | |
Iterator category tags | |
Defined in namespace
std::experimental::ranges | |
empty class types used to indicate iterator categories (class) | |
std::iterator_traits specializations | |
Defined in namespace
std | |
specializes std::iterator_traits for ranges TS iterators (class template specialization) | |
Iterator operations | |
Defined in namespace
std::experimental::ranges | |
advances an iterator by given distance (function template) | |
returns the distance between an iterator and a sentinel, or between the beginning and the end of a range (function template) | |
increment an iterator (function template) | |
decrement an iterator (function template) | |
Iterator adaptors | |
Defined in namespace
std::experimental::ranges | |
iterator adaptor for reverse-order traversal (class template) | |
iterator adaptor for insertion at the end of a container (class template) | |
iterator adaptor for insertion at the front of a container (class template) | |
iterator adaptor for insertion into a container (class template) | |
iterator adaptor which dereferences to an rvalue reference (class template) | |
sentinel adaptor for use with move_iterator (class template) | |
adapt an iterator-sentinel pair into a common iterator type for use with legacy algorithms (class template) | |
iterator adaptor that keeps track of its distance from its starting position (class template) | |
empty sentinel type for use with iterator types that know the bound of their range (class) | |
wrapper for a possibly dangling iterator (class template) | |
alias template that wraps the iterator type of an rvalue range with dangling (alias template) | |
sentinel type used with any iterator to denote an infinite range (class) | |
Stream iterators | |
Defined in namespace
std::experimental::ranges | |
input iterator that reads from std::basic_istream (class template) | |
output iterator that writes to std::basic_ostream (class template) | |
input iterator that reads from |