Namespaces
Variants
Views
Actions

Difference between revisions of "cpp/experimental/ranges"

From cppreference.com
(move this up with the rest of tagged)
m (fmt)
 
(29 intermediate revisions by 4 users not shown)
Line 2: Line 2:
 
{{cpp/experimental/ranges/navbar}}
 
{{cpp/experimental/ranges/navbar}}
  
The C++ Extensions for Ranges, ISO/IEC TS 21425:XXXX, specifies one modification to the core language and defines new components for the C++ standard library listed on this page.
+
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 [[cpp/language/constraints|Concepts TS]].
+
The Ranges TS is based on the C++14 standard as modified by the {{rlp|constraints|Concepts TS}}.
  
==== Core language changes ====
+
{{fmbox|class=noprint|style=font-size: 0.8em|text='''Merged into ISO C++''' The functionality described on this page was merged into the mainline ISO C++ standard as of 10/2018; see [[cpp/ranges|the ranges library]], [[cpp/algorithm/ranges|the constrained algorithms library]], and [[cpp/concepts|the core concepts library]] {{mark since c++20}}}}
The Ranges TS modifies the specification of [[cpp/language/range-for|the range-based {{c|for}} loop]] to permit differently typed begin and end iterators. This change permits the use of sentinels and is also present in C++17.
+
  
==== Concepts ====
+
====Core language changes====
 +
The Ranges TS modifies the specification of [[cpp/language/range-for|the range-based {{c|for}} loop]] to permit differently typed begin and end iterators. This change permits the use of sentinels and is also present in C++17.
  
 +
====Concepts====
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc header | experimental/ranges/concepts}}
+
{{dsc h2|Core language concepts}}
{{dsc namespace |std::experimental::ranges}}
+
{{dsc header|experimental/ranges/concepts}}
{{dsc h2 | Core language concepts}}
+
{{dsc namespace|std::experimental::ranges}}
{{dsc rconcept | cpp/experimental/ranges/concepts/Same | Specifies that a type is the same as another type}}
+
{{dsc inc|cpp/experimental/ranges/concepts/dsc Same}}
{{dsc rconcept | cpp/experimental/ranges/concepts/DerivedFrom | Specifies that a type is derived from another type}}
+
{{dsc inc|cpp/experimental/ranges/concepts/dsc DerivedFrom}}
{{dsc rconcept | cpp/experimental/ranges/concepts/ConvertibleTo | Specifies that a type is implicitly convertible to another type}}
+
{{dsc inc|cpp/experimental/ranges/concepts/dsc ConvertibleTo}}
{{dsc rconcept | cpp/experimental/ranges/concepts/CommonReference| Specifies that two types share a common reference type}}
+
{{dsc inc|cpp/experimental/ranges/concepts/dsc CommonReference}}
{{dsc rconcept | cpp/experimental/ranges/concepts/Common | Specifies that two types share a common type}}
+
{{dsc inc|cpp/experimental/ranges/concepts/dsc Common}}
{{dsc rconcept | cpp/experimental/ranges/concepts/Integral | Specifies that a type is an integral type}}
+
{{dsc inc|cpp/experimental/ranges/concepts/dsc Integral}}
{{dsc rconcept | cpp/experimental/ranges/concepts/SignedIntegral | Specifies that a type is a integral type that is signed}}
+
{{dsc inc|cpp/experimental/ranges/concepts/dsc SignedIntegral}}
{{dsc rconcept | cpp/experimental/ranges/concepts/UnsignedIntegral | Specifies that a type is an integral type that is not signed}}
+
{{dsc inc|cpp/experimental/ranges/concepts/dsc UnsignedIntegral}}
{{dsc rconcept | cpp/experimental/ranges/concepts/Assignable | Specifies that a type is assignable from another type}}
+
{{dsc inc|cpp/experimental/ranges/concepts/dsc Assignable}}
{{dsc rconcept | cpp/experimental/ranges/concepts/Swappable | Specifies that a type can be swapped or that two types can be swapped with each other}}
+
{{dsc inc|cpp/experimental/ranges/concepts/dsc Swappable}}
{{dsc h2 | Comparison concepts}}
+
{{dsc h2|Comparison concepts}}
{{dsc rconcept | cpp/experimental/ranges/concepts/Boolean | Specifies that a type can be used in Boolean contexts}}
+
{{dsc header|experimental/ranges/concepts}}
{{dsc rconcept | cpp/experimental/ranges/concepts/WeaklyEqualityComparable| title=WeaklyEqualityComparable |Specifies that two types can be compared for equality using operators {{c|1===}} and {{c|1=!=}}  }}
+
{{dsc namespace|std::experimental::ranges}}
{{dsc rconcept | cpp/experimental/ranges/concepts/EqualityComparable | title=EqualityComparable |Specifies that operator {{c|1===}} is an equivalence relation }}
+
{{dsc inc|cpp/experimental/ranges/concepts/dsc Boolean}}
{{dsc rconcept | cpp/experimental/ranges/concepts/StrictTotallyOrdered | specifies that the comparison operators on the type yield a total order}}
+
{{dsc inc|cpp/experimental/ranges/concepts/dsc WeaklyEqualityComparableWith}}
{{dsc h2 | Object concepts}}
+
{{dsc inc|cpp/experimental/ranges/concepts/dsc EqualityComparable}}
{{dsc rconcept | cpp/experimental/ranges/concepts/Destructible| Specifies that an object of the type can be destroyed and have its address taken with unary {{c|&}} }}
+
{{dsc inc|cpp/experimental/ranges/concepts/dsc StrictTotallyOrdered}}
{{dsc rconcept | cpp/experimental/ranges/concepts/Constructible| Specifies that a variable of the type can be constructed from or bound to a set of argument types }}
+
{{dsc h2|Object concepts}}
{{dsc rconcept | cpp/experimental/ranges/concepts/DefaultConstructible| Specifies that an object of a type can be default constructed }}
+
{{dsc header|experimental/ranges/concepts}}
{{dsc rconcept | cpp/experimental/ranges/concepts/MoveConstructible|Specifies that an object of a type can be move constructed}}
+
{{dsc namespace|std::experimental::ranges}}
{{dsc rconcept | cpp/experimental/ranges/concepts/CopyConstructible|Specifies that an object of a type can be copy constructed and move constructed  }}
+
{{dsc inc|cpp/experimental/ranges/concepts/dsc Destructible}}
{{dsc rconcept | cpp/experimental/ranges/concepts/Movable|Specifies that an object of a type can be moved and swapped}}
+
{{dsc inc|cpp/experimental/ranges/concepts/dsc Constructible}}
{{dsc rconcept | cpp/experimental/ranges/concepts/Copyable|Specifies that an object of a type can be copied, moved, and swapped }}
+
{{dsc inc|cpp/experimental/ranges/concepts/dsc DefaultConstructible}}
{{dsc rconcept | cpp/experimental/ranges/concepts/Semiregular| Specifies that an object of a type can be copied, moved, swapped, and default constructed}}
+
{{dsc inc|cpp/experimental/ranges/concepts/dsc MoveConstructible}}
{{dsc rconcept | cpp/experimental/ranges/concepts/Regular| Specifies that a type is regular, that is, it is both {{rconcept|Semiregular}} and {{rconcept|EqualityComparable}} }}
+
{{dsc inc|cpp/experimental/ranges/concepts/dsc CopyConstructible}}
{{dsc h2 | Callable concepts}}
+
{{dsc inc|cpp/experimental/ranges/concepts/dsc Movable}}
{{dsc rconcept | cpp/experimental/ranges/concepts/Invocable|title=Invocable<br/>RegularInvocable |Specifies that a callable type can be invoked with a given set of argument types }}
+
{{dsc inc|cpp/experimental/ranges/concepts/dsc Copyable}}
{{dsc rconcept | cpp/experimental/ranges/concepts/Predicate| Specifies that a callable type is a Boolean predicate }}
+
{{dsc inc|cpp/experimental/ranges/concepts/dsc Semiregular}}
{{dsc rconcept | cpp/experimental/ranges/concepts/Relation| Specifies that a callable type is a binary relation }}
+
{{dsc inc|cpp/experimental/ranges/concepts/dsc Regular}}
{{dsc rconcept | cpp/experimental/ranges/concepts/StrictWeakOrder| Specifies that a {{rconcept|Relation}} imposes a strict weak ordering }}
+
{{dsc h2|Callable concepts}}
 +
{{dsc header|experimental/ranges/concepts}}
 +
{{dsc namespace|std::experimental::ranges}}
 +
{{dsc inc|cpp/experimental/ranges/concepts/dsc Invocable}}
 +
{{dsc inc|cpp/experimental/ranges/concepts/dsc Predicate}}
 +
{{dsc inc|cpp/experimental/ranges/concepts/dsc Relation}}
 +
{{dsc inc|cpp/experimental/ranges/concepts/dsc StrictWeakOrder}}
 +
{{dsc h2|Random number generator concept}}
 +
{{dsc header|experimental/ranges/random}}
 +
{{dsc namespace|std::experimental::ranges}}
 +
{{dsc inc|cpp/experimental/ranges/concepts/dsc UniformRandomNumberGenerator}}
 
{{dsc end}}
 
{{dsc end}}
  
==== General utilities ====
+
====General utilities====
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc h2 | Utility components}}
+
{{dsc h2|Utility components}}
{{dsc header | experimental/ranges/utility}}
+
{{dsc header|experimental/ranges/utility}}
{{dsc namespace |std::experimental::ranges}}
+
{{dsc namespace|std::experimental::ranges}}
{{dsc custpt  | cpp/experimental/ranges/utility/swap | Swaps the value of two objects}}
+
{{dsc inc|cpp/experimental/ranges/utility/dsc swap}}
{{dsc tfun    | cpp/experimental/ranges/utility/exchange | replaces the argument with a new value and returns its previous value }}
+
{{dsc inc|cpp/experimental/ranges/utility/dsc exchange}}
{{dsc h2 | Function objects }}
+
{{dsc h2|Function objects}}
{{dsc header | experimental/ranges/functional}}
+
{{dsc header|experimental/ranges/functional}}
{{dsc namespace |std::experimental::ranges}}
+
{{dsc namespace|std::experimental::ranges}}
{{dsc tfun    | cpp/experimental/ranges/functional/invoke | Invokes a {{concept|Callable}} object with the given arguments}}
+
{{dsc inc|cpp/experimental/ranges/functional/dsc invoke}}
{{dsc tclass  | cpp/experimental/ranges/functional/equal_to|function object implementing {{c|1=x == y}} }}
+
{{dsc inc|cpp/experimental/ranges/functional/dsc equal_to}}
{{dsc tclass  | cpp/experimental/ranges/functional/not_equal_to|function object implementing {{c|1=x != y}}}}
+
{{dsc inc|cpp/experimental/ranges/functional/dsc not_equal_to}}
{{dsc tclass  | cpp/experimental/ranges/functional/greater|function object implementing {{c|x > y}}}}
+
{{dsc inc|cpp/experimental/ranges/functional/dsc greater}}
{{dsc tclass  | cpp/experimental/ranges/functional/less|function object implementing {{c|x < y}}}}
+
{{dsc inc|cpp/experimental/ranges/functional/dsc less}}
{{dsc tclass  | cpp/experimental/ranges/functional/greater_equal|function object implementing {{c|1=x >= y}}}}
+
{{dsc inc|cpp/experimental/ranges/functional/dsc greater_equal}}
{{dsc tclass  | cpp/experimental/ranges/functional/less_equal|function object implementing {{c|1=x <= y}}}}
+
{{dsc inc|cpp/experimental/ranges/functional/dsc less_equal}}
{{dsc class  | cpp/experimental/ranges/functional/identity|function object that returns its argument unchanged}}
+
{{dsc inc|cpp/experimental/ranges/functional/dsc identity}}
{{dsc h2 | Metaprogramming and type traits }}
+
{{dsc h2|Metaprogramming and type traits}}
{{dsc header | type_traits}}
+
{{dsc header|experimental/ranges/type_traits}}
{{dsc namespace | std }}
+
{{dsc namespace|std::experimental::ranges}}
{{dsc tclass  | cpp/experimental/ranges/type_traits/is_swappable|title=is_swappable_with<br/>is_swappable<br/>is_nothrow_swappable_with<br/>is_nothrow_swappable|checks if objects of a type can be swapped with objects of same or different type }}
+
{{dsc inc|cpp/experimental/ranges/type_traits/dsc is_swappable}}
{{dsc tclass  | cpp/experimental/ranges/type_traits/common_reference|title=basic_common_reference<br/>common_reference}}
+
{{dsc inc|cpp/experimental/ranges/type_traits/dsc common_reference}}
{{dsc tclass  | cpp/experimental/ranges/type_traits/common_type}}
+
{{dsc inc|cpp/experimental/ranges/type_traits/dsc common_type}}
{{dsc h2 | Tagged pairs and tuples}}
+
{{dsc h2|Tagged pairs and tuples}}
{{dsc namespace |std::experimental::ranges}}
+
{{dsc header|experimental/ranges/utility}}
{{dsc header | experimental/ranges/utility}}
+
{{dsc namespace|std::experimental::ranges}}
{{dsc rconcept | cpp/experimental/ranges/utility/TagSpecifier | }}
+
{{dsc inc|cpp/experimental/ranges/utility/dsc TagSpecifier}}
{{dsc rconcept | cpp/experimental/ranges/utility/TaggedType| }}
+
{{dsc inc|cpp/experimental/ranges/utility/dsc TaggedType}}
{{dsc tclass  | cpp/experimental/ranges/utility/tagged | }}
+
{{dsc inc|cpp/experimental/ranges/utility/dsc tagged}}
{{dsc talias  | cpp/experimental/ranges/utility/tagged_pair| }}
+
{{dsc inc|cpp/experimental/ranges/utility/dsc tagged_pair}}
{{dsc tfun    | cpp/experimental/ranges/utility/make_tagged_pair| }}
+
{{dsc inc|cpp/experimental/ranges/utility/dsc make_tagged_pair}}
{{dsc header | experimental/ranges/tuple}}
+
{{dsc header|experimental/ranges/tuple}}
{{dsc talias  | cpp/experimental/ranges/utility/tagged_tuple| }}
+
{{dsc inc|cpp/experimental/ranges/utility/dsc tagged_tuple}}
{{dsc tfun    | cpp/experimental/ranges/utility/make_tagged_tuple| }}
+
{{dsc inc|cpp/experimental/ranges/utility/dsc make_tagged_tuple}}
{{dsc header | experimental/ranges/algorithm}}
+
{{dsc header|experimental/ranges/algorithm}}
 
{{dsc namespace|std::experimental::ranges::tag}}
 
{{dsc namespace|std::experimental::ranges::tag}}
{{dsc class | cpp/experimental/ranges/algorithm/tags | title=in<br>in1<br>in2<br>out<br>out1<br>out2<br>fun<br>min<br>max<br>begin<br>end| Tag specifiers for use with {{lc|ranges::tagged}}}}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc tags}}
 
{{dsc end}}
 
{{dsc end}}
  
==== Iterators ====
+
====Iterators====
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc header | experimental/ranges/iterator}}
+
{{dsc header|experimental/ranges/iterator}}
{{dsc h2 | Iterator concepts}} <!--- no actual wording that says it lives in <.../iterator>...or which namespaces they live in --->
+
{{dsc h2|Iterator-related concepts}}
{{dsc namespace |std::experimental::ranges}}
+
{{dsc namespace|std::experimental::ranges}}
{{dsc rconcept | cpp/experimental/ranges/iterator/Readable| }}
+
{{dsc h3|Iterator concepts}}
{{dsc rconcept | cpp/experimental/ranges/iterator/Writable| }}
+
{{dsc inc|cpp/experimental/ranges/iterator/dsc Readable}}
{{dsc rconcept | cpp/experimental/ranges/iterator/WeaklyIncrementable| }}
+
{{dsc inc|cpp/experimental/ranges/iterator/dsc Writable}}
{{dsc rconcept | cpp/experimental/ranges/iterator/Incrementable| }}
+
{{dsc inc|cpp/experimental/ranges/iterator/dsc WeaklyIncrementable}}
{{dsc rconcept | cpp/experimental/ranges/iterator/Iterator| }}
+
{{dsc inc|cpp/experimental/ranges/iterator/dsc Incrementable}}
{{dsc rconcept | cpp/experimental/ranges/iterator/Sentinel| }}
+
{{dsc inc|cpp/experimental/ranges/iterator/dsc Iterator}}
{{dsc rconcept | cpp/experimental/ranges/iterator/SizedSentinel| }}
+
{{dsc inc|cpp/experimental/ranges/iterator/dsc Sentinel}}
{{dsc tvar    | cpp/experimental/ranges/iterator/disable_sized_sentinel| }}
+
{{dsc inc|cpp/experimental/ranges/iterator/dsc SizedSentinel}}
{{dsc rconcept | cpp/experimental/ranges/iterator/InputIterator| }}
+
{{dsc inc|cpp/experimental/ranges/iterator/dsc InputIterator}}
{{dsc rconcept | cpp/experimental/ranges/iterator/OutputIterator| }}
+
{{dsc inc|cpp/experimental/ranges/iterator/dsc OutputIterator}}
{{dsc rconcept | cpp/experimental/ranges/iterator/ForwardIterator| }}
+
{{dsc inc|cpp/experimental/ranges/iterator/dsc ForwardIterator}}
{{dsc rconcept | cpp/experimental/ranges/iterator/BidirectionalIterator| }}
+
{{dsc inc|cpp/experimental/ranges/iterator/dsc BidirectionalIterator}}
{{dsc rconcept | cpp/experimental/ranges/iterator/RandomAccessIterator| }}
+
{{dsc inc|cpp/experimental/ranges/iterator/dsc RandomAccessIterator}}
{{dsc h3 | Indirect callable concepts }}
+
{{dsc h3|Indirect callable concepts}}
{{dsc rconcept | cpp/experimental/ranges/iterator/IndirectInvocable|title= IndirectInvocable<br/>IndirectRegularInvocable }}
+
{{dsc inc|cpp/experimental/ranges/iterator/dsc IndirectUnaryInvocable}}
{{dsc rconcept | cpp/experimental/ranges/iterator/IndirectPredicate| }}
+
{{dsc inc|cpp/experimental/ranges/iterator/dsc IndirectUnaryPredicate}}
{{dsc rconcept | cpp/experimental/ranges/iterator/IndirectRelation| }}
+
{{dsc inc|cpp/experimental/ranges/iterator/dsc IndirectRelation}}
{{dsc rconcept | cpp/experimental/ranges/iterator/IndirectStrictWeakOrder| }}
+
{{dsc inc|cpp/experimental/ranges/iterator/dsc IndirectStrictWeakOrder}}
{{dsc tclass  | cpp/experimental/ranges/iterator/indirect_result_of}}
+
{{dsc h3|Common algorithm requirements}}
{{dsc tclass  | cpp/experimental/ranges/iterator/projected}}
+
{{dsc inc|cpp/experimental/ranges/iterator/dsc IndirectlyMovable}}
{{dsc h3 | Common algorithm requirements}}
+
{{dsc inc|cpp/experimental/ranges/iterator/dsc IndirectlyMovableStorable}}
{{dsc rconcept | cpp/experimental/ranges/iterator/IndirectlyMovable| }}
+
{{dsc inc|cpp/experimental/ranges/iterator/dsc IndirectlyCopyable}}
{{dsc rconcept | cpp/experimental/ranges/iterator/IndirectlyMovableStorable| }}
+
{{dsc inc|cpp/experimental/ranges/iterator/dsc IndirectlyCopyableStorable}}
{{dsc rconcept | cpp/experimental/ranges/iterator/IndirectlyCopyable| }}
+
{{dsc inc|cpp/experimental/ranges/iterator/dsc IndirectlySwappable}}
{{dsc rconcept | cpp/experimental/ranges/iterator/IndirectlyCopyableStorable| }}
+
{{dsc inc|cpp/experimental/ranges/iterator/dsc IndirectlyComparable}}
{{dsc rconcept | cpp/experimental/ranges/iterator/IndirectlySwappable| }}
+
{{dsc inc|cpp/experimental/ranges/iterator/dsc Permutable}}
{{dsc rconcept | cpp/experimental/ranges/iterator/IndirectlyComparable| }}
+
{{dsc inc|cpp/experimental/ranges/iterator/dsc Mergeable}}
{{dsc rconcept | cpp/experimental/ranges/iterator/Permutable| }}
+
{{dsc inc|cpp/experimental/ranges/iterator/dsc Sortable}}
{{dsc rconcept | cpp/experimental/ranges/iterator/Mergeable| }}
+
{{dsc h3|Concept utilities}}
{{dsc rconcept | cpp/experimental/ranges/iterator/Sortable| }}
+
{{dsc inc|cpp/experimental/ranges/iterator/dsc indirect_result_of}}
 +
{{dsc inc|cpp/experimental/ranges/iterator/dsc projected}}
 +
{{dsc h2|Iterator primitives}}
 +
{{dsc h3|Iterator utilities}}
 +
{{dsc namespace|std::experimental::ranges}}
 +
{{dsc inc|cpp/experimental/ranges/iterator/dsc iter_move}}
 +
{{dsc inc|cpp/experimental/ranges/iterator/dsc iter_swap}}
 +
{{dsc h3|Iterator traits}}
 +
{{dsc namespace|std::experimental::ranges}}
 +
{{dsc inc|cpp/experimental/ranges/iterator/dsc difference_type}}
 +
{{dsc inc|cpp/experimental/ranges/iterator/dsc value_type}}
 +
{{dsc inc|cpp/experimental/ranges/iterator/dsc iterator_category}}
 +
{{dsc inc|cpp/experimental/ranges/iterator/dsc iterator_traits}}
 +
{{dsc inc|cpp/experimental/ranges/iterator/dsc reference_t}}
 +
{{dsc h3|Iterator category tags}}
 +
{{dsc namespace|std::experimental::ranges}}
 +
{{dsc inc|cpp/experimental/ranges/iterator/dsc iterator_tags}}
 +
{{dsc h3|{{lc|std::iterator_traits}} specializations}}
 +
{{dsc namespace|std}}
 +
{{dsc inc|cpp/experimental/ranges/iterator/dsc std_iter_traits}}
 +
{{dsc h3|Iterator operations}}
 +
{{dsc namespace|std::experimental::ranges}}
 +
{{dsc inc|cpp/experimental/ranges/iterator/dsc advance}}
 +
{{dsc inc|cpp/experimental/ranges/iterator/dsc distance}}
 +
{{dsc inc|cpp/experimental/ranges/iterator/dsc next}}
 +
{{dsc inc|cpp/experimental/ranges/iterator/dsc prev}}
 +
{{dsc h2|Iterator adaptors}}
 +
{{dsc namespace|std::experimental::ranges}}
 +
{{dsc inc|cpp/experimental/ranges/iterator/dsc reverse_iterator}}
 +
{{dsc inc|cpp/experimental/ranges/iterator/dsc back_insert_iterator}}
 +
{{dsc inc|cpp/experimental/ranges/iterator/dsc front_insert_iterator}}
 +
{{dsc inc|cpp/experimental/ranges/iterator/dsc insert_iterator}}
 +
{{dsc inc|cpp/experimental/ranges/iterator/dsc move_iterator}}
 +
{{dsc inc|cpp/experimental/ranges/iterator/dsc move_sentinel}}
 +
{{dsc inc|cpp/experimental/ranges/iterator/dsc common_iterator}}
 +
{{dsc inc|cpp/experimental/ranges/iterator/dsc counted_iterator}}
 +
{{dsc inc|cpp/experimental/ranges/iterator/dsc default_sentinel}}
 +
{{dsc inc|cpp/experimental/ranges/iterator/dsc dangling}}
 +
{{dsc inc|cpp/experimental/ranges/iterator/dsc safe_iterator_t}}
 +
{{dsc inc|cpp/experimental/ranges/iterator/dsc unreachable}}
 +
{{dsc h2|Stream iterators}}
 +
{{dsc namespace|std::experimental::ranges}}
 +
{{dsc inc|cpp/experimental/ranges/iterator/dsc istream_iterator}}
 +
{{dsc inc|cpp/experimental/ranges/iterator/dsc ostream_iterator}}
 +
{{dsc inc|cpp/experimental/ranges/iterator/dsc istreambuf_iterator}}
 +
{{dsc inc|cpp/experimental/ranges/iterator/dsc ostreambuf_iterator}}
 +
{{dsc end}}
  
{{dsc h2 | Iterator primitives }}
+
====Ranges====
{{dsc h3 | Iterator utilities}}
+
{{dsc begin}}
{{dsc namespace |std::experimental::ranges}}
+
{{dsc header|experimental/ranges/range}}
{{dsc custpt  | cpp/experimental/ranges/iterator/iter_move}}
+
{{dsc h2|Range concepts}}
{{dsc custpt  | cpp/experimental/ranges/iterator/iter_swap}}
+
{{dsc inc|cpp/experimental/ranges/range/dsc Range}}
{{dsc h3 | Iterator traits}}
+
{{dsc inc|cpp/experimental/ranges/range/dsc SizedRange}}
{{dsc namespace |std::experimental::ranges}}
+
{{dsc inc|cpp/experimental/ranges/range/dsc View}}
{{dsc tclass  | cpp/experimental/ranges/iterator/difference_type}}
+
{{dsc inc|cpp/experimental/ranges/range/dsc BoundedRange}}
{{dsc tclass  | cpp/experimental/ranges/iterator/value_type}}
+
{{dsc inc|cpp/experimental/ranges/range/dsc InputRange}}
{{dsc tclass  | cpp/experimental/ranges/iterator/iterator_category}}
+
{{dsc inc|cpp/experimental/ranges/range/dsc OutputRange}}
{{dsc talias  | cpp/experimental/ranges/iterator/iterator_traits}}
+
{{dsc inc|cpp/experimental/ranges/range/dsc ForwardRange}}
{{dsc talias  | cpp/experimental/ranges/iterator/reference_t}}
+
{{dsc inc|cpp/experimental/ranges/range/dsc BidirectionalRange}}
{{dsc talias  | cpp/experimental/ranges/iterator/rvalue_reference_t}}
+
{{dsc inc|cpp/experimental/ranges/range/dsc RandomAccessRange}}
{{dsc talias  | cpp/experimental/ranges/iterator/iter_common_reference_t}}
+
{{dsc h2|Range access}}
{{dsc tclass  | cpp/experimental/ranges/iterator/is_indirectly_movable|title= is_indirectly_movable<br/>is_nothrow_indirectly_movable}}
+
{{dsc namespace|std::experimental::ranges}}
{{dsc tclass  | cpp/experimental/ranges/iterator/is_indirectly_swappable|title= is_indirectly_swappable<br/>is_nothrow_indirectly_swappable}}
+
{{dsc inc|cpp/experimental/ranges/range/dsc begin}}
{{dsc h3 | Iterator category tags }}
+
{{dsc inc|cpp/experimental/ranges/range/dsc end}}
{{dsc namespace |std::experimental::ranges}}
+
{{dsc inc|cpp/experimental/ranges/range/dsc rbegin}}
{{dsc class | cpp/experimental/ranges/iterator/iterator_tags | title=input_iterator_tag<br>output_iterator_tag<br>forward_iterator_tag<br>bidirectional_iterator_tag<br>random_access_iterator_tag| empty class types used to indicate iterator categories}}
+
{{dsc inc|cpp/experimental/ranges/range/dsc rend}}
{{dsc h3 | {{lc|std::iterator_traits}} specializations}}
+
{{dsc h2|Range primitives}}
{{dsc namespace |std}}
+
{{dsc namespace|std::experimental::ranges}}
{{dsc ptclass | cpp/experimental/ranges/iterator/std_iter_traits|title=std::iterator_traits{{small|<InputIterator>}}<br/>std::iterator_traits{{small|<OutputIterator>}}|Specializes {{lc|std::iterator_traits}} for ranges TS iterators}}
+
{{dsc inc|cpp/experimental/ranges/range/dsc size}}
{{dsc h3 | Iterator operations}}
+
{{dsc inc|cpp/experimental/ranges/range/dsc empty}}
{{dsc namespace |std::experimental::ranges}}
+
{{dsc inc|cpp/experimental/ranges/range/dsc data}}
{{dsc tfun    | cpp/experimental/ranges/iterator/advance }}
+
{{dsc inc|cpp/experimental/ranges/range/dsc iterator_t}}
{{dsc tfun    | cpp/experimental/ranges/iterator/distance }}
+
{{dsc tfun    | cpp/experimental/ranges/iterator/next }}
+
{{dsc tfun    | cpp/experimental/ranges/iterator/prev }}
+
{{dsc h2 | Iterator adaptors}}
+
{{dsc namespace |std::experimental::ranges}}
+
{{dsc tclass  | cpp/experimental/ranges/iterator/reverse_iterator}}
+
{{dsc tclass  | cpp/experimental/ranges/iterator/back_insert_iterator}}
+
{{dsc tclass  | cpp/experimental/ranges/iterator/front_insert_iterator}}
+
{{dsc tclass  | cpp/experimental/ranges/iterator/insert_iterator}}
+
{{dsc tclass  | cpp/experimental/ranges/iterator/move_iterator}}
+
{{dsc tclass  | cpp/experimental/ranges/iterator/move_sentinel}}
+
{{dsc tclass  | cpp/experimental/ranges/iterator/common_iterator}}
+
{{dsc tclass  | cpp/experimental/ranges/iterator/counted_iterator}}
+
{{dsc class    | cpp/experimental/ranges/iterator/default_sentinel}}
+
{{dsc tclass  | cpp/experimental/ranges/iterator/dangling}}
+
{{dsc talias  | cpp/experimental/ranges/iterator/safe_iterator_t}}
+
{{dsc class    | cpp/experimental/ranges/iterator/unreachable}}
+
{{dsc h2 | Stream iterators}}
+
{{dsc namespace |std::experimental::ranges}}
+
{{dsc tclass  | cpp/experimental/ranges/iterator/istream_iterator}}
+
{{dsc tclass  | cpp/experimental/ranges/iterator/ostream_iterator}}
+
{{dsc tclass  | cpp/experimental/ranges/iterator/istreambuf_iterator}}
+
{{dsc tclass  | cpp/experimental/ranges/iterator/ostreambuf_iterator}}
+
 
+
{{dsc h2 | Range concepts}}
+
{{dsc namespace |std::experimental::ranges}}
+
{{dsc talias  | cpp/experimental/ranges/iterator/iterator_t}}
+
{{dsc talias  | cpp/experimental/ranges/iterator/sentinel_t}}
+
{{dsc rconcept | cpp/experimental/ranges/iterator/Range | }}
+
{{dsc rconcept | cpp/experimental/ranges/iterator/SizedRange | }}
+
{{dsc tvar    | cpp/experimental/ranges/iterator/disable_sized_range}}
+
{{dsc class    | cpp/experimental/ranges/iterator/view_base}}
+
{{dsc tclass  | cpp/experimental/ranges/iterator/enable_view}}
+
{{dsc rconcept | cpp/experimental/ranges/iterator/View| }}
+
{{dsc rconcept | cpp/experimental/ranges/iterator/BoundedRange | }}
+
{{dsc rconcept | cpp/experimental/ranges/iterator/InputRange | }}
+
{{dsc rconcept | cpp/experimental/ranges/iterator/OutputRange | }}
+
{{dsc rconcept | cpp/experimental/ranges/iterator/ForwardRange | }}
+
{{dsc rconcept | cpp/experimental/ranges/iterator/BidirectionalRange | }}
+
{{dsc rconcept | cpp/experimental/ranges/iterator/RandomAccessRange | }}
+
{{dsc h2 | Range access }}
+
{{dsc namespace |std::experimental::ranges}}
+
{{dsc custpt  | cpp/experimental/ranges/iterator/begin | }}
+
{{dsc custpt  | cpp/experimental/ranges/iterator/end | }}
+
{{dsc custpt  | cpp/experimental/ranges/iterator/cbegin | }}
+
{{dsc custpt  | cpp/experimental/ranges/iterator/cend | }}
+
{{dsc custpt  | cpp/experimental/ranges/iterator/rbegin | }}
+
{{dsc custpt  | cpp/experimental/ranges/iterator/rend | }}
+
{{dsc custpt  | cpp/experimental/ranges/iterator/crbegin | }}
+
{{dsc custpt  | cpp/experimental/ranges/iterator/crend | }}
+
{{dsc h2 | Range primitives }}
+
{{dsc namespace |std::experimental::ranges}}
+
{{dsc tfun    | cpp/experimental/ranges/iterator/distance | }}
+
{{dsc custpt  | cpp/experimental/ranges/iterator/size | }}
+
{{dsc custpt  | cpp/experimental/ranges/iterator/empty| }}
+
{{dsc custpt  | cpp/experimental/ranges/iterator/data | }}
+
{{dsc custpt  | cpp/experimental/ranges/iterator/cdata | }}
+
 
{{dsc end}}
 
{{dsc end}}
  
==== Algorithms ====
+
====Algorithms====
 
{{dsc begin}}
 
{{dsc begin}}
{{dsc header | experimental/ranges/algorithm}}
+
{{dsc header|experimental/ranges/algorithm}}
{{dsc h2 | Non-modifying sequence operations}}
+
{{dsc h2|Non-modifying sequence operations}}
{{dsc namespace |std::experimental::ranges}}
+
{{dsc namespace|std::experimental::ranges}}
{{dsc tfun | cpp/experimental/ranges/algorithm/all_any_none_of | title=all_of<br>any_of<br>none_of | checks if a predicate is {{c|true}} for all, any or none of the elements in a range }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc all_any_none_of}}
{{dsc tfun | cpp/experimental/ranges/algorithm/for_each | applies a function to a range of elements}}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc for_each}}
{{dsc tfun | cpp/experimental/ranges/algorithm/count | title=count<br>count_if | returns the number of elements satisfying specific criteria }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc count}}
{{dsc tfun | cpp/experimental/ranges/algorithm/mismatch | finds the first position where two ranges differ }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc mismatch}}
{{dsc tfun | cpp/experimental/ranges/algorithm/equal | determines if two sets of elements are the same }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc equal}}
{{dsc tfun | cpp/experimental/ranges/algorithm/find | title=find<br>find_if<br>find_if_not | finds the first element satisfying specific criteria}}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc lexicographical_compare}}
{{dsc tfun | cpp/experimental/ranges/algorithm/find_end | finds the last sequence of elements in a certain range }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc find}}
{{dsc tfun | cpp/experimental/ranges/algorithm/find_first_of | searches for any one of a set of elements }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc find_end}}
{{dsc tfun | cpp/experimental/ranges/algorithm/adjacent_find | finds the first two adjacent items that are equal (or satisfy a given predicate) }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc find_first_of}}
{{dsc tfun | cpp/experimental/ranges/algorithm/search | searches for a range of elements }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc adjacent_find}}
{{dsc tfun | cpp/experimental/ranges/algorithm/search_n | searches for a number consecutive copies of an element in a range }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc search}}
 +
{{dsc inc|cpp/experimental/ranges/algorithm/dsc search_n}}
  
{{dsc h2 | Modifying sequence operations}}
+
{{dsc h2|Modifying sequence operations}}
{{dsc namespace |std::experimental::ranges}}
+
{{dsc namespace|std::experimental::ranges}}
{{dsc tfun | cpp/experimental/ranges/algorithm/copy | copies a range of elements to a new location | title=copy<br>copy_if }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc copy}}
{{dsc tfun | cpp/experimental/ranges/algorithm/copy_n | copies a number of elements to a new location  }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc copy_n}}
{{dsc tfun | cpp/experimental/ranges/algorithm/copy_backward | copies a range of elements in backwards order }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc copy_backward}}
{{dsc tfun | cpp/experimental/ranges/algorithm/move | moves a range of elements to a new location  }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc move}}
{{dsc tfun | cpp/experimental/ranges/algorithm/move_backward | moves a range of elements to a new location in backwards order}}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc move_backward}}
{{dsc tfun | cpp/experimental/ranges/algorithm/fill | assigns a range of elements a certain value }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc fill}}
{{dsc tfun | cpp/experimental/ranges/algorithm/fill_n | assigns a value to a number of elements }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc fill_n}}
{{dsc tfun | cpp/experimental/ranges/algorithm/transform | applies a function to a range of elements }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc transform}}
{{dsc tfun | cpp/experimental/ranges/algorithm/generate | saves the result of a function in a range }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc generate}}
{{dsc tfun | cpp/experimental/ranges/algorithm/generate_n | saves the result of N applications of a function }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc generate_n}}
{{dsc tfun | cpp/experimental/ranges/algorithm/remove | title=remove<br>remove_if | removes elements satisfying specific criteria }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc remove}}
{{dsc tfun | cpp/experimental/ranges/algorithm/remove_copy | title=remove_copy<br>remove_copy_if | copies a range of elements omitting those that satisfy specific criteria }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc remove_copy}}
{{dsc tfun | cpp/experimental/ranges/algorithm/replace | title=replace<br>replace_if| replaces all values satisfying specific criteria with another value }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc replace}}
{{dsc tfun | cpp/experimental/ranges/algorithm/replace_copy | title=replace_copy<br>replace_copy_if | copies a range, replacing elements satisfying specific criteria with another value }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc replace_copy}}
{{dsc tfun | cpp/experimental/ranges/algorithm/swap_ranges | swaps two ranges of elements }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc swap_ranges}}
{{dsc tfun | cpp/experimental/ranges/algorithm/reverse | reverses the order of elements in a range }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc reverse}}
{{dsc tfun | cpp/experimental/ranges/algorithm/reverse_copy | creates a copy of a range that is reversed }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc reverse_copy}}
{{dsc tfun | cpp/experimental/ranges/algorithm/rotate | rotates the order of elements in a range }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc rotate}}
{{dsc tfun | cpp/experimental/ranges/algorithm/rotate_copy | copies and rotate a range of elements }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc rotate_copy}}
{{dsc tfun | cpp/experimental/ranges/algorithm/shuffle | randomly re-orders elements in a range }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc shuffle}}
{{dsc tfun | cpp/experimental/ranges/algorithm/unique | removes consecutive duplicate elements in a range }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc unique}}
{{dsc tfun | cpp/experimental/ranges/algorithm/unique_copy | creates a copy of some range of elements that contains no consecutive duplicates }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc unique_copy}}
  
{{dsc h2 | Partitioning operations}}
+
{{dsc h2|Partitioning operations}}
{{dsc namespace |std::experimental::ranges}}
+
{{dsc namespace|std::experimental::ranges}}
{{dsc tfun | cpp/experimental/ranges/algorithm/is_partitioned | determines if the range is partitioned by the given predicate  }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc is_partitioned}}
{{dsc tfun | cpp/experimental/ranges/algorithm/partition | divides a range of elements into two groups }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc partition}}
{{dsc tfun | cpp/experimental/ranges/algorithm/partition_copy | copies a range dividing the elements into two groups }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc partition_copy}}
{{dsc tfun | cpp/experimental/ranges/algorithm/stable_partition | divides elements into two groups while preserving their relative order }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc stable_partition}}
{{dsc tfun | cpp/experimental/ranges/algorithm/partition_point | locates the partition point of a partitioned range }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc partition_point}}
  
{{dsc h2 | Sorting operations}}
+
{{dsc h2|Sorting operations}}
{{dsc namespace |std::experimental::ranges}}
+
{{dsc namespace|std::experimental::ranges}}
{{dsc tfun | cpp/experimental/ranges/algorithm/is_sorted | checks whether a range is sorted into ascending order }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc is_sorted}}
{{dsc tfun | cpp/experimental/ranges/algorithm/is_sorted_until | finds the largest sorted subrange }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc is_sorted_until}}
{{dsc tfun | cpp/experimental/ranges/algorithm/sort | sorts a range into ascending order }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc sort}}
{{dsc tfun | cpp/experimental/ranges/algorithm/partial_sort | sorts the first N elements of a range }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc partial_sort}}
{{dsc tfun | cpp/experimental/ranges/algorithm/partial_sort_copy | copies and partially sorts a range of elements }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc partial_sort_copy}}
{{dsc tfun | cpp/experimental/ranges/algorithm/stable_sort | sorts a range of elements while preserving order between equal elements }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc stable_sort}}
{{dsc tfun | cpp/experimental/ranges/algorithm/nth_element | partially sorts the given range making sure that it is partitioned by the given element }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc nth_element}}
  
{{dsc h2 | Binary search operations (on sorted ranges)}}
+
{{dsc h2|Binary search operations (on sorted ranges)}}
{{dsc namespace |std::experimental::ranges}}
+
{{dsc namespace|std::experimental::ranges}}
{{dsc tfun | cpp/experimental/ranges/algorithm/lower_bound | returns an iterator to the first element ''not less'' than the given value}}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc lower_bound}}
{{dsc tfun | cpp/experimental/ranges/algorithm/upper_bound | returns an iterator to the first element ''greater'' than a certain value}}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc upper_bound}}
{{dsc tfun | cpp/experimental/ranges/algorithm/binary_search | determines if an element exists in a certain range }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc binary_search}}
{{dsc tfun | cpp/experimental/ranges/algorithm/equal_range | returns range of elements matching a specific key}}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc equal_range}}
  
{{dsc h2 | Set operations (on sorted ranges)}}
+
{{dsc h2|Set operations (on sorted ranges)}}
{{dsc namespace |std::experimental::ranges}}
+
{{dsc namespace|std::experimental::ranges}}
{{dsc tfun | cpp/experimental/ranges/algorithm/merge | merges two sorted ranges }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc merge}}
{{dsc tfun | cpp/experimental/ranges/algorithm/inplace_merge | merges two ordered ranges in-place }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc inplace_merge}}
{{dsc tfun | cpp/experimental/ranges/algorithm/includes | returns true if one set is a subset of another }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc includes}}
{{dsc tfun | cpp/experimental/ranges/algorithm/set_difference | computes the difference between two sets }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc set_difference}}
{{dsc tfun | cpp/experimental/ranges/algorithm/set_intersection | computes the intersection of two sets }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc set_intersection}}
{{dsc tfun | cpp/experimental/ranges/algorithm/set_symmetric_difference | computes the symmetric difference between two sets }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc set_symmetric_difference}}
{{dsc tfun | cpp/experimental/ranges/algorithm/set_union | computes the union of two sets }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc set_union}}
  
{{dsc h2 | Heap operations}}
+
{{dsc h2|Heap operations}}
{{dsc namespace |std::experimental::ranges}}
+
{{dsc namespace|std::experimental::ranges}}
{{dsc tfun | cpp/experimental/ranges/algorithm/is_heap | checks if the given range is a max heap}}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc is_heap}}
{{dsc tfun | cpp/experimental/ranges/algorithm/is_heap_until | finds the largest subrange that is a max heap }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc is_heap_until}}
{{dsc tfun | cpp/experimental/ranges/algorithm/make_heap | creates a max heap out of a range of elements }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc make_heap}}
{{dsc tfun | cpp/experimental/ranges/algorithm/push_heap | adds an element to a max heap }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc push_heap}}
{{dsc tfun | cpp/experimental/ranges/algorithm/pop_heap | removes the largest element from a max heap }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc pop_heap}}
{{dsc tfun | cpp/experimental/ranges/algorithm/sort_heap | turns a max heap into a range of elements sorted in ascending order }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc sort_heap}}
  
{{dsc h2 | Minimum/maximum operations}}
+
{{dsc h2|Minimum/maximum operations}}
{{dsc namespace |std::experimental::ranges}}
+
{{dsc namespace|std::experimental::ranges}}
{{dsc tfun | cpp/experimental/ranges/algorithm/max | returns the greater of the given values }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc max}}
{{dsc tfun | cpp/experimental/ranges/algorithm/max_element | returns the largest element in a range }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc max_element}}
{{dsc tfun | cpp/experimental/ranges/algorithm/min | returns the smaller of the given values }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc min}}
{{dsc tfun | cpp/experimental/ranges/algorithm/min_element | returns the smallest element in a range }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc min_element}}
{{dsc tfun | cpp/experimental/ranges/algorithm/minmax | returns the smaller and larger of two elements }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc minmax}}
{{dsc tfun | cpp/experimental/ranges/algorithm/minmax_element | returns the smallest and the largest elements in a range }}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc minmax_element}}
{{dsc tfun | cpp/experimental/ranges/algorithm/lexicographical_compare | returns true if one range is lexicographically less than another }}
+
{{dsc tfun | cpp/experimental/ranges/algorithm/is_permutation | determines if a sequence is a permutation of another sequence }}
+
{{dsc tfun | cpp/experimental/ranges/algorithm/next_permutation | generates the next greater lexicographic permutation of a range of elements }}
+
{{dsc tfun | cpp/experimental/ranges/algorithm/prev_permutation | generates the next smaller lexicographic permutation of a range of elements }}
+
{{dsc end}}
+
  
==== Random number generator concept====
+
{{dsc h2|Permutation operations}}
{{dsc begin}}
+
{{dsc namespace|std::experimental::ranges}}
{{dsc header|experimental/ranges/random}}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc is_permutation}}
{{dsc namespace |std::experimental::ranges}}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc next_permutation}}
{{dsc rconcept|cpp/experimental/ranges/random/UniformRandomNumberGenerator}}
+
{{dsc inc|cpp/experimental/ranges/algorithm/dsc prev_permutation}}
 
{{dsc end}}
 
{{dsc end}}
 +
 +
{{langlinks|ru|zh}}

Latest revision as of 10:56, 28 November 2023

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 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 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 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 both Semiregular and EqualityComparable
(concept) [edit]
Callable 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 a Relation 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]

[edit] General utilities

Utility components
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 namespace std::experimental::ranges
invokes a Callable object with the given arguments
(function template) [edit]
function object implementing x == y
(class template) [edit]
function object implementing x != y
(class template) [edit]
function object implementing x > y
(class template) [edit]
function object implementing x < y
(class template) [edit]
function object implementing x >= y
(class template) [edit]
function object implementing x <= y
(class template) [edit]
function object that returns its argument unchanged
(class) [edit]
Metaprogramming and 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 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 tagged std::pair
(alias template)[edit]
convenience function for creating a tagged_pair
(function template) [edit]
Defined in header <experimental/ranges/tuple>
alias template for a tagged std::tuple
(alias template)[edit]
convenience function for creating a tagged_tuple
(function template) [edit]
Defined in namespace std::experimental::ranges::tag
tag specifiers for use with ranges::tagged
(class) [edit]

[edit] Iterators

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 a Semiregular type can be incremented with pre- and post-increment operators
(concept) [edit]
specifies that the increment operation on a WeaklyIncrementable type is equality-preserving and that the type is EqualityComparable
(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 an Iterator 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 an InputIterator is a forward iterator, supporting equality comparison and multi-pass
(concept) [edit]
specifies that a ForwardIterator is a bidirectional iterator, supporting movement backwards
(concept) [edit]
specifies that a BidirectionalIterator 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 a Readable type
(concept) [edit]
specifies that a callable object, when invoked with the result of dereferencing a Readable type, satisfies Predicate
(concept) [edit]
specifies that a callable object, when invoked with the result of dereferencing some Readable types, satisfies Relation
(concept) [edit]
specifies that a callable object, when invoked with the result of dereferencing some Readable types, satisfies StrictWeakOrder
(concept) [edit]
Common algorithm requirements
specifies that values may be moved from a Readable type to a Writable type
(concept) [edit]
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) [edit]
specifies that values may be copied from a Readable type to a Writable type
(concept) [edit]
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) [edit]
specifies that the values referenced by two Readable types can be swapped
(concept) [edit]
specifies that the values referenced by two Readable 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 of Readable 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 a WeaklyIncrementable type
(class template) [edit]
obtains the value type of a Readable 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
specializes std::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 with move_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 with dangling
(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 from std::basic_istream
(class template) [edit]
output iterator that writes to std::basic_ostream
(class template) [edit]
input iterator that reads from std::basic_streambuf
(class template) [edit]
output iterator that writes to std::basic_streambuf
(class template) [edit]

[edit] Ranges

Defined in header <experimental/ranges/range>
Range concepts
specifies that a type is a range, that is, it provides a begin iterator and an end 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 satisfies InputIterator
(concept) [edit]
specifies a range whose iterator type satisfies OutputIterator
(concept) [edit]
specifies a range whose iterator type satisfies ForwardIterator
(concept) [edit]
specifies a range whose iterator type satisfies BidirectionalIterator
(concept) [edit]
specifies a range whose iterator type satisfies RandomAccessIterator
(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]

[edit] Algorithms

Non-modifying sequence operations
Defined in namespace std::experimental::ranges
checks if a predicate is true 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]
returns true 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 element not less than the given value
(function template) [edit]
returns an iterator to the first element greater 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]
returns true 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]