| Technical Specification | ||||
| Filesystem library(filesystem TS) | ||||
| Library fundamentals(library fundamentals TS) | ||||
| Library fundamentals 2(library fundamentals TS v2) | ||||
| Library fundamentals 3(library fundamentals TS v3) | ||||
| Extensions for parallelism(parallelism TS) | ||||
| Extensions for parallelism 2(parallelism TS v2) | ||||
| Extensions for concurrency(concurrency TS) | ||||
| Extensions for concurrency 2(concurrency TS v2) | ||||
| Concepts(concepts TS) | ||||
| Ranges(ranges TS) | ||||
| Reflection(reflection TS) | ||||
| Mathematical special functions(special functions TR) | ||||
| Experimental Non-TS | ||||
| Pattern Matching | ||||
| Linear Algebra | ||||
| std::execution | ||||
| Contracts | ||||
| 2D Graphics |
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 theConcepts TS.
![]() | Merged into ISO C++ The functionality described on this page was merged into the mainline ISO C++ standard as of 10/2018; seethe ranges library,the constrained algorithms library, andthe core concepts library(since C++20) |
Contents |
The Ranges TS modifies the specification ofthe range-basedfor loop to permit differently typed begin and end iterators. This change permits the use of sentinels and is also present in C++17.
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)[edit] | |
| specifies that a type is derived from another type (concept)[edit] | |
| specifies that a type is implicitly convertible to another type (concept)[edit] | |
| specifies that two types share a common reference type (concept)[edit] | |
| specifies that two types share a common type (concept)[edit] | |
| specifies that a type is an integral type (concept)[edit] | |
| specifies that a type is an integral type that is signed (concept)[edit] | |
| specifies that a type is an integral type that is not signed (concept)[edit] | |
| specifies that a type is assignable from another type (concept)[edit] | |
| specifies that a type can be swapped or that two types can be swapped with each other (concept)[edit] | |
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)[edit] | |
| specifies that two types can be compared for equality using operators== and!= (concept)[edit] | |
| specifies that operator== is an equivalence relation (concept)[edit] | |
| specifies that the comparison operators on the type yield a total order (concept)[edit] | |
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)[edit] | |
| specifies that a variable of the type can be constructed from or bound to a set of argument types (concept)[edit] | |
| specifies that an object of a type can be default constructed (concept)[edit] | |
| specifies that an object of a type can be move constructed (concept)[edit] | |
| specifies that an object of a type can be copy constructed and move constructed (concept)[edit] | |
| specifies that an object of a type can be moved and swapped (concept)[edit] | |
| specifies that an object of a type can be copied, moved, and swapped (concept)[edit] | |
| specifies that an object of a type can be copied, moved, swapped, and default constructed (concept)[edit] | |
specifies that a type is regular, that is, it is bothSemiregular andEqualityComparable(concept)[edit] | |
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)[edit] | |
| specifies that a callable type is a Boolean predicate (concept)[edit] | |
| specifies that a callable type is a binary relation (concept)[edit] | |
specifies that aRelation imposes a strict weak ordering(concept)[edit] | |
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] | |
Utility components | |
Defined in header <experimental/ranges/utility> | |
Defined in namespace std::experimental::ranges | |
| swaps the value of two objects (customization point object)[edit] | |
| replaces the argument with a new value and returns its previous value (function template)[edit] | |
Function objects | |
Defined in header <experimental/ranges/functional> | |
Defined in namespace std::experimental::ranges | |
| invokes aCallable object with the given arguments (function template)[edit] | |
| function object implementingx== y (class template)[edit] | |
| function object implementingx!= y (class template)[edit] | |
| function object implementingx> y (class template)[edit] | |
| function object implementingx< y (class template)[edit] | |
| function object implementingx>= y (class template)[edit] | |
| function object implementingx<= y (class template)[edit] | |
| function object that returns its argument unchanged (class)[edit] | |
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)[edit] | |
| determine the common reference type of a set of types (class template)[edit] | |
| determine the common type of a set of types (class template)[edit] | |
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)[edit] | |
| specifies that a type represents a tag specifier and its element type (concept)[edit] | |
| augument a tuple-like type with named accessors (class template)[edit] | |
| alias template for a taggedstd::pair (alias template)[edit] | |
convenience function for creating atagged_pair(function template)[edit] | |
Defined in header <experimental/ranges/tuple> | |
| alias template for a taggedstd::tuple (alias template)[edit] | |
convenience function for creating atagged_tuple(function template)[edit] | |
Defined in header <experimental/ranges/algorithm> | |
Defined in namespace std::experimental::ranges::tag | |
| tag specifiers for use withranges::tagged (class)[edit] | |
Defined in header <experimental/ranges/iterator> | |
Iterator-related concepts | |
Defined in namespace std::experimental::ranges | |
Iterator concepts | |
specifies that a type is readable by applying operator*(concept)[edit] | |
| specifies that a value can be written to an iterator's referenced object (concept)[edit] | |
specifies that aSemiregular type can be incremented with pre- and post-increment operators(concept)[edit] | |
specifies that the increment operation on aWeaklyIncrementable type is equality-preserving and that the type isEqualityComparable(concept)[edit] | |
| specifies that objects of a type can be incremented and dereferenced (concept)[edit] | |
specifies that objects of a type is a sentinel for anIterator type(concept)[edit] | |
specifies that the- operator can be applied to an iterator and a sentinel to calculate their difference in constant time(concept)[edit] | |
| 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)[edit] | |
| 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)[edit] | |
specifies that anInputIterator is a forward iterator, supporting equality comparison and multi-pass(concept)[edit] | |
specifies that aForwardIterator is a bidirectional iterator, supporting movement backwards(concept)[edit] | |
specifies that aBidirectionalIterator is a random-access iterator, supporting advancement in constant time and subscripting(concept)[edit] | |
Indirect callable concepts | |
specifies that a callable type can be invoked with the result of dereferencing aReadable type(concept)[edit] | |
specifies that a callable object, when invoked with the result of dereferencing aReadable type, satisfiesPredicate(concept)[edit] | |
specifies that a callable object, when invoked with the result of dereferencing someReadable types, satisfiesRelation(concept)[edit] | |
specifies that a callable object, when invoked with the result of dereferencing someReadable types, satisfiesStrictWeakOrder(concept)[edit] | |
Common algorithm requirements | |
specifies that values may be moved from aReadable type to aWritable type(concept)[edit] | |
specifies that values may be moved from aReadable type to aWritable type and that the move may be performed via an intermediate object(concept)[edit] | |
specifies that values may be copied from aReadable type to aWritable type(concept)[edit] | |
specifies that values may be copied from aReadable type to aWritable type and that the copy may be performed via an intermediate object(concept)[edit] | |
specifies that the values referenced by twoReadable types can be swapped(concept)[edit] | |
specifies that the values referenced by twoReadable types can be compared(concept)[edit] | |
| specifies the common requirements of algorithms that reorder elements in place (concept)[edit] | |
| specifies the requirements of algorithms that merge sorted sequences into an output sequence by copying elements (concept)[edit] | |
| specifies the common requirements of algorithms that permute sequences into ordered sequences (concept)[edit] | |
Concept utilities | |
compute the result of invoking a callable object on the result of dereferencing some set ofReadable types(class template)[edit] | |
| helper template for specifying the constraints on algorithms that accept projections (class template)[edit] | |
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)[edit] | |
| swap the values referenced by two dereferenceable objects (customization point object)[edit] | |
Iterator traits | |
Defined in namespace std::experimental::ranges | |
obtains the difference type of aWeaklyIncrementable type(class template)[edit] | |
obtains the value type of aReadable type(class template)[edit] | |
| obtains the iterator category of an input iterator type (class template)[edit] | |
| compatibility traits class that collects an iterator’s associated types (alias template)[edit] | |
| obtains a dereferenceable object's associated reference types (alias template)[edit] | |
Iterator category tags | |
Defined in namespace std::experimental::ranges | |
| empty class types used to indicate iterator categories (class)[edit] | |
std::iterator_traits specializations | |
Defined in namespace std | |
| specializesstd::iterator_traits for ranges TS iterators (class template specialization)[edit] | |
Iterator operations | |
Defined in namespace std::experimental::ranges | |
| advances an iterator by given distance (function template)[edit] | |
| returns the distance between an iterator and a sentinel, or between the beginning and the end of a range (function template)[edit] | |
| increment an iterator (function template)[edit] | |
| decrement an iterator (function template)[edit] | |
Iterator adaptors | |
Defined in namespace std::experimental::ranges | |
| iterator adaptor for reverse-order traversal (class template)[edit] | |
| iterator adaptor for insertion at the end of a container (class template)[edit] | |
| iterator adaptor for insertion at the front of a container (class template)[edit] | |
| iterator adaptor for insertion into a container (class template)[edit] | |
| iterator adaptor which dereferences to an rvalue reference (class template)[edit] | |
sentinel adaptor for use withmove_iterator(class template)[edit] | |
| adapt an iterator-sentinel pair into a common iterator type for use with legacy algorithms (class template)[edit] | |
| iterator adaptor that keeps track of its distance from its starting position (class template)[edit] | |
| empty sentinel type for use with iterator types that know the bound of their range (class)[edit] | |
| wrapper for a possibly dangling iterator (class template)[edit] | |
alias template that wraps the iterator type of an rvalue range withdangling(alias template)[edit] | |
| sentinel type used with any iterator to denote an infinite range (class)[edit] | |
Stream iterators | |
Defined in namespace std::experimental::ranges | |
| input iterator that reads fromstd::basic_istream (class template)[edit] | |
| output iterator that writes tostd::basic_ostream (class template)[edit] | |
| input iterator that reads fromstd::basic_streambuf (class template)[edit] | |
| output iterator that writes tostd::basic_streambuf (class template)[edit] | |
Defined in header <experimental/ranges/range> | |
Range concepts | |
specifies that a type is a range, that is, it provides abegin iterator and anend sentinel(concept)[edit] | |
| specifies that a range knows its size in constant time (concept)[edit] | |
| specifies that a range is a view, that is, it has constant time copy/move/assignment (concept)[edit] | |
| specifies that a range has identical iterator and sentinel types (concept)[edit] | |
specifies a range whose iterator type satisfiesInputIterator(concept)[edit] | |
specifies a range whose iterator type satisfiesOutputIterator(concept)[edit] | |
specifies a range whose iterator type satisfiesForwardIterator(concept)[edit] | |
specifies a range whose iterator type satisfiesBidirectionalIterator(concept)[edit] | |
specifies a range whose iterator type satisfiesRandomAccessIterator(concept)[edit] | |
Range access | |
Defined in namespace std::experimental::ranges | |
| returns an iterator to the beginning of a range (customization point object)[edit] | |
| returns an iterator to the end of a range (customization point object)[edit] | |
| returns a reverse iterator to a range (customization point object)[edit] | |
| returns a reverse end iterator to a range (customization point object)[edit] | |
Range primitives | |
Defined in namespace std::experimental::ranges | |
| obtains the size of a range whose size can be calculated in constant time (customization point object)[edit] | |
| checks whether a range is empty (customization point object)[edit] | |
| obtains a pointer to the beginning of a contiguous range (customization point object)[edit] | |
| obtains the iterator and sentinel types of a range (alias template)[edit] | |
Defined in header <experimental/ranges/algorithm> | |
Non-modifying sequence operations | |
Defined in namespace std::experimental::ranges | |
| checks if a predicate istrue for all, any or none of the elements in a range (function template)[edit] | |
| applies a function to a range of elements (function template)[edit] | |
| returns the number of elements satisfying specific criteria (function template)[edit] | |
| finds the first position where two ranges differ (function template)[edit] | |
| determines if two sets of elements are the same (function template)[edit] | |
| returnstrue if one range is lexicographically less than another (function template)[edit] | |
| finds the first element satisfying specific criteria (function template)[edit] | |
| finds the last sequence of elements in a certain range (function template)[edit] | |
| searches for any one of a set of elements (function template)[edit] | |
| finds the first two adjacent items that are equal (or satisfy a given predicate) (function template)[edit] | |
| searches for a range of elements (function template)[edit] | |
| searches for a number consecutive copies of an element in a range (function template)[edit] | |
Modifying sequence operations | |
Defined in namespace std::experimental::ranges | |
| copies a range of elements to a new location (function template)[edit] | |
| copies a number of elements to a new location (function template)[edit] | |
| copies a range of elements in backwards order (function template)[edit] | |
| moves a range of elements to a new location (function template)[edit] | |
| moves a range of elements to a new location in backwards order (function template)[edit] | |
| assigns a range of elements a certain value (function template)[edit] | |
| assigns a value to a number of elements (function template)[edit] | |
| applies a function to a range of elements (function template)[edit] | |
| saves the result of a function in a range (function template)[edit] | |
| saves the result of N applications of a function (function template)[edit] | |
| removes elements satisfying specific criteria (function template)[edit] | |
| copies a range of elements omitting those that satisfy specific criteria (function template)[edit] | |
| replaces all values satisfying specific criteria with another value (function template)[edit] | |
| copies a range, replacing elements satisfying specific criteria with another value (function template)[edit] | |
| swaps two ranges of elements (function template)[edit] | |
| reverses the order of elements in a range (function template)[edit] | |
| creates a copy of a range that is reversed (function template)[edit] | |
| rotates the order of elements in a range (function template)[edit] | |
| copies and rotate a range of elements (function template)[edit] | |
| randomly re-orders elements in a range (function template)[edit] | |
| removes consecutive duplicate elements in a range (function template)[edit] | |
| creates a copy of some range of elements that contains no consecutive duplicates (function template)[edit] | |
Partitioning operations | |
Defined in namespace std::experimental::ranges | |
| determines if the range is partitioned by the given predicate (function template)[edit] | |
| divides a range of elements into two groups (function template)[edit] | |
| copies a range dividing the elements into two groups (function template)[edit] | |
| divides elements into two groups while preserving their relative order (function template)[edit] | |
| locates the partition point of a partitioned range (function template)[edit] | |
Sorting operations | |
Defined in namespace std::experimental::ranges | |
| checks whether a range is sorted into ascending order (function template)[edit] | |
| finds the largest sorted subrange (function template)[edit] | |
| sorts a range into ascending order (function template)[edit] | |
| sorts the first N elements of a range (function template)[edit] | |
| copies and partially sorts a range of elements (function template)[edit] | |
| sorts a range of elements while preserving order between equal elements (function template)[edit] | |
| partially sorts the given range making sure that it is partitioned by the given element (function template)[edit] | |
Binary search operations (on sorted ranges) | |
Defined in namespace std::experimental::ranges | |
| returns an iterator to the first elementnot less than the given value (function template)[edit] | |
| returns an iterator to the first elementgreater than a certain value (function template)[edit] | |
| determines if an element exists in a certain range (function template)[edit] | |
| returns range of elements matching a specific key (function template)[edit] | |
Set operations (on sorted ranges) | |
Defined in namespace std::experimental::ranges | |
| merges two sorted ranges (function template)[edit] | |
| merges two ordered ranges in-place (function template)[edit] | |
| returnstrue if one set is a subset of another (function template)[edit] | |
| computes the difference between two sets (function template)[edit] | |
| computes the intersection of two sets (function template)[edit] | |
| computes the symmetric difference between two sets (function template)[edit] | |
| computes the union of two sets (function template)[edit] | |
Heap operations | |
Defined in namespace std::experimental::ranges | |
| checks if the given range is a max heap (function template)[edit] | |
| finds the largest subrange that is a max heap (function template)[edit] | |
| creates a max heap out of a range of elements (function template)[edit] | |
| adds an element to a max heap (function template)[edit] | |
| removes the largest element from a max heap (function template)[edit] | |
| turns a max heap into a range of elements sorted in ascending order (function template)[edit] | |
Minimum/maximum operations | |
Defined in namespace std::experimental::ranges | |
| returns the greater of the given values (function template)[edit] | |
| returns the largest element in a range (function template)[edit] | |
| returns the smaller of the given values (function template)[edit] | |
| returns the smallest element in a range (function template)[edit] | |
| returns the smaller and larger of two elements (function template)[edit] | |
| returns the smallest and the largest elements in a range (function template)[edit] | |
Permutation operations | |
Defined in namespace std::experimental::ranges | |
| determines if a sequence is a permutation of another sequence (function template)[edit] | |
| generates the next greater lexicographic permutation of a range of elements (function template)[edit] | |
| generates the next smaller lexicographic permutation of a range of elements (function template)[edit] | |