Difference between revisions of "cpp/experimental/ranges"
From cppreference.com
< cpp | experimental
(move this up with the rest of tagged) |
Andreas Krug (Talk | contribs) 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: | + | 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 | + | The Ranges TS is based on the C++14 standard as modified by the {{rlp|constraints|Concepts TS}}. |
− | === | + | {{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 | + | |
− | ==== | + | ====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 | + | {{dsc namespace|std::experimental::ranges}} |
− | + | {{dsc inc|cpp/experimental/ranges/concepts/dsc Same}} | |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/concepts/dsc DerivedFrom}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/concepts/dsc ConvertibleTo}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/concepts/dsc CommonReference}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/concepts/dsc Common}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/concepts/dsc Integral}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/concepts/dsc SignedIntegral}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/concepts/dsc UnsignedIntegral}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/concepts/dsc Assignable}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/concepts/dsc Swappable}} |
− | {{dsc h2 | Comparison concepts}} | + | {{dsc h2|Comparison concepts}} |
− | {{dsc | + | {{dsc header|experimental/ranges/concepts}} |
− | {{dsc | + | {{dsc namespace|std::experimental::ranges}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/concepts/dsc Boolean}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/concepts/dsc WeaklyEqualityComparableWith}} |
− | {{dsc h2 | Object concepts}} | + | {{dsc inc|cpp/experimental/ranges/concepts/dsc EqualityComparable}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/concepts/dsc StrictTotallyOrdered}} |
− | {{dsc | + | {{dsc h2|Object concepts}} |
− | {{dsc | + | {{dsc header|experimental/ranges/concepts}} |
− | {{dsc | + | {{dsc namespace|std::experimental::ranges}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/concepts/dsc Destructible}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/concepts/dsc Constructible}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/concepts/dsc DefaultConstructible}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/concepts/dsc MoveConstructible}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/concepts/dsc CopyConstructible}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/concepts/dsc Movable}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/concepts/dsc Copyable}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/concepts/dsc Semiregular}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/concepts/dsc Regular}} |
− | {{dsc | + | {{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 | + | {{dsc inc|cpp/experimental/ranges/utility/dsc swap}} |
− | {{dsc | + | {{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 | + | {{dsc inc|cpp/experimental/ranges/functional/dsc invoke}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/functional/dsc equal_to}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/functional/dsc not_equal_to}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/functional/dsc greater}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/functional/dsc less}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/functional/dsc greater_equal}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/functional/dsc less_equal}} |
− | {{dsc | + | {{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 | + | {{dsc inc|cpp/experimental/ranges/type_traits/dsc is_swappable}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/type_traits/dsc common_reference}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/type_traits/dsc common_type}} |
− | {{dsc h2 | Tagged pairs and tuples}} | + | {{dsc h2|Tagged pairs and tuples}} |
− | {{dsc | + | {{dsc header|experimental/ranges/utility}} |
− | {{dsc | + | {{dsc namespace|std::experimental::ranges}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/utility/dsc TagSpecifier}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/utility/dsc TaggedType}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/utility/dsc tagged}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/utility/dsc tagged_pair}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/utility/dsc make_tagged_pair}} |
− | {{dsc header | experimental/ranges/tuple}} | + | {{dsc header|experimental/ranges/tuple}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/utility/dsc tagged_tuple}} |
− | {{dsc | + | {{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 | + | {{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}} | + | {{dsc h2|Iterator-related concepts}} |
− | {{dsc namespace |std::experimental::ranges}} | + | {{dsc namespace|std::experimental::ranges}} |
− | {{dsc | + | {{dsc h3|Iterator concepts}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/iterator/dsc Readable}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/iterator/dsc Writable}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/iterator/dsc WeaklyIncrementable}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/iterator/dsc Incrementable}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/iterator/dsc Iterator}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/iterator/dsc Sentinel}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/iterator/dsc SizedSentinel}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/iterator/dsc InputIterator}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/iterator/dsc OutputIterator}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/iterator/dsc ForwardIterator}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/iterator/dsc BidirectionalIterator}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/iterator/dsc RandomAccessIterator}} |
− | {{dsc h3 | | + | {{dsc h3|Indirect callable concepts}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/iterator/dsc IndirectUnaryInvocable}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/iterator/dsc IndirectUnaryPredicate}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/iterator/dsc IndirectRelation}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/iterator/dsc IndirectStrictWeakOrder}} |
− | {{dsc | + | {{dsc h3|Common algorithm requirements}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/iterator/dsc IndirectlyMovable}} |
− | {{dsc h3 | | + | {{dsc inc|cpp/experimental/ranges/iterator/dsc IndirectlyMovableStorable}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/iterator/dsc IndirectlyCopyable}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/iterator/dsc IndirectlyCopyableStorable}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/iterator/dsc IndirectlySwappable}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/iterator/dsc IndirectlyComparable}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/iterator/dsc Permutable}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/iterator/dsc Mergeable}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/iterator/dsc Sortable}} |
− | {{dsc | + | {{dsc h3|Concept utilities}} |
− | {{dsc | + | {{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}} | ||
− | + | ====Ranges==== | |
− | + | {{dsc begin}} | |
− | + | {{dsc header|experimental/ranges/range}} | |
− | + | {{dsc h2|Range concepts}} | |
− | + | {{dsc inc|cpp/experimental/ranges/range/dsc Range}} | |
− | + | {{dsc inc|cpp/experimental/ranges/range/dsc SizedRange}} | |
− | + | {{dsc inc|cpp/experimental/ranges/range/dsc View}} | |
− | + | {{dsc inc|cpp/experimental/ranges/range/dsc BoundedRange}} | |
− | + | {{dsc inc|cpp/experimental/ranges/range/dsc InputRange}} | |
− | + | {{dsc inc|cpp/experimental/ranges/range/dsc OutputRange}} | |
− | + | {{dsc inc|cpp/experimental/ranges/range/dsc ForwardRange}} | |
− | + | {{dsc inc|cpp/experimental/ranges/range/dsc BidirectionalRange}} | |
− | + | {{dsc inc|cpp/experimental/ranges/range/dsc RandomAccessRange}} | |
− | + | {{dsc h2|Range access}} | |
− | + | {{dsc namespace|std::experimental::ranges}} | |
− | + | {{dsc inc|cpp/experimental/ranges/range/dsc begin}} | |
− | + | {{dsc inc|cpp/experimental/ranges/range/dsc end}} | |
− | + | {{dsc inc|cpp/experimental/ranges/range/dsc rbegin}} | |
− | + | {{dsc inc|cpp/experimental/ranges/range/dsc rend}} | |
− | + | {{dsc h2|Range primitives}} | |
− | + | {{dsc namespace|std::experimental::ranges}} | |
− | + | {{dsc inc|cpp/experimental/ranges/range/dsc size}} | |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/range/dsc empty}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/range/dsc data}} |
− | + | {{dsc inc|cpp/experimental/ranges/range/dsc iterator_t}} | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | {{dsc h2 | Range concepts}} | + | |
− | {{dsc | + | |
− | + | ||
− | + | ||
− | {{dsc | + | |
− | + | ||
− | {{dsc | + | |
− | + | ||
− | {{dsc | + | |
− | + | ||
− | {{dsc | + | |
− | + | ||
− | {{dsc | + | |
− | {{dsc | + | |
− | {{dsc | + | |
− | {{dsc | + | |
− | {{dsc h2 | Range access }} | + | |
− | {{dsc namespace |std::experimental::ranges}} | + | |
− | {{dsc | + | |
− | {{dsc | + | |
− | {{dsc | + | |
− | + | ||
− | {{dsc | + | |
− | + | ||
− | + | ||
− | + | ||
− | {{dsc h2 | Range primitives }} | + | |
− | {{dsc namespace |std::experimental::ranges}} | + | |
− | {{dsc | + | |
− | + | ||
− | {{dsc | + | |
− | {{dsc | + | |
− | {{dsc | + | |
{{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 | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc all_any_none_of}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc for_each}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc count}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc mismatch}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc equal}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc lexicographical_compare}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc find}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc find_end}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc find_first_of}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc adjacent_find}} |
− | {{dsc | + | {{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 | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc copy}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc copy_n}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc copy_backward}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc move}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc move_backward}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc fill}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc fill_n}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc transform}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc generate}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc generate_n}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc remove}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc remove_copy}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc replace}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc replace_copy}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc swap_ranges}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc reverse}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc reverse_copy}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc rotate}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc rotate_copy}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc shuffle}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc unique}} |
− | {{dsc | + | {{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 | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc is_partitioned}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc partition}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc partition_copy}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc stable_partition}} |
− | {{dsc | + | {{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 | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc is_sorted}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc is_sorted_until}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc sort}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc partial_sort}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc partial_sort_copy}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc stable_sort}} |
− | {{dsc | + | {{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 | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc lower_bound}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc upper_bound}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc binary_search}} |
− | {{dsc | + | {{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 | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc merge}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc inplace_merge}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc includes}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc set_difference}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc set_intersection}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc set_symmetric_difference}} |
− | {{dsc | + | {{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 | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc is_heap}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc is_heap_until}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc make_heap}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc push_heap}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc pop_heap}} |
− | {{dsc | + | {{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 | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc max}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc max_element}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc min}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc min_element}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc minmax}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc minmax_element}} |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | {{dsc h2|Permutation operations}} | |
− | {{dsc | + | {{dsc namespace|std::experimental::ranges}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc is_permutation}} |
− | {{dsc | + | {{dsc inc|cpp/experimental/ranges/algorithm/dsc next_permutation}} |
− | {{dsc | + | {{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 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 std::basic_streambuf (class template) | |
output iterator that writes to std::basic_streambuf (class template) |
[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) | |
specifies that a range knows its size in constant time (concept) | |
specifies that a range is a view, that is, it has constant time copy/move/assignment (concept) | |
specifies that a range has identical iterator and sentinel types (concept) | |
specifies a range whose iterator type satisfies InputIterator (concept) | |
specifies a range whose iterator type satisfies OutputIterator (concept) | |
specifies a range whose iterator type satisfies ForwardIterator (concept) | |
specifies a range whose iterator type satisfies BidirectionalIterator (concept) | |
specifies a range whose iterator type satisfies RandomAccessIterator (concept) | |
Range access | |
Defined in namespace
std::experimental::ranges | |
returns an iterator to the beginning of a range (customization point object) | |
returns an iterator to the end of a range (customization point object) | |
returns a reverse iterator to a range (customization point object) | |
returns a reverse end iterator to a range (customization point object) | |
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) | |
checks whether a range is empty (customization point object) | |
obtains a pointer to the beginning of a contiguous range (customization point object) | |
obtains the iterator and sentinel types of a range (alias template) |
[edit] Algorithms
Defined in header
<experimental/ranges/algorithm> | |
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) | |
applies a function to a range of elements (function template) | |
returns the number of elements satisfying specific criteria (function template) | |
finds the first position where two ranges differ (function template) | |
determines if two sets of elements are the same (function template) | |
returns true if one range is lexicographically less than another (function template) | |
finds the first element satisfying specific criteria (function template) | |
finds the last sequence of elements in a certain range (function template) | |
searches for any one of a set of elements (function template) | |
finds the first two adjacent items that are equal (or satisfy a given predicate) (function template) | |
searches for a range of elements (function template) | |
searches for a number consecutive copies of an element in a range (function template) | |
Modifying sequence operations | |
Defined in namespace
std::experimental::ranges | |
copies a range of elements to a new location (function template) | |
copies a number of elements to a new location (function template) | |
copies a range of elements in backwards order (function template) | |
moves a range of elements to a new location (function template) | |
moves a range of elements to a new location in backwards order (function template) | |
assigns a range of elements a certain value (function template) | |
assigns a value to a number of elements (function template) | |
applies a function to a range of elements (function template) | |
saves the result of a function in a range (function template) | |
saves the result of N applications of a function (function template) | |
removes elements satisfying specific criteria (function template) | |
copies a range of elements omitting those that satisfy specific criteria (function template) | |
replaces all values satisfying specific criteria with another value (function template) | |
copies a range, replacing elements satisfying specific criteria with another value (function template) | |
swaps two ranges of elements (function template) | |
reverses the order of elements in a range (function template) | |
creates a copy of a range that is reversed (function template) | |
rotates the order of elements in a range (function template) | |
copies and rotate a range of elements (function template) | |
randomly re-orders elements in a range (function template) | |
removes consecutive duplicate elements in a range (function template) | |
creates a copy of some range of elements that contains no consecutive duplicates (function template) | |
Partitioning operations | |
Defined in namespace
std::experimental::ranges | |
determines if the range is partitioned by the given predicate (function template) | |
divides a range of elements into two groups (function template) | |
copies a range dividing the elements into two groups (function template) | |
divides elements into two groups while preserving their relative order (function template) | |
locates the partition point of a partitioned range (function template) | |
Sorting operations | |
Defined in namespace
std::experimental::ranges | |
checks whether a range is sorted into ascending order (function template) | |
finds the largest sorted subrange (function template) | |
sorts a range into ascending order (function template) | |
sorts the first N elements of a range (function template) | |
copies and partially sorts a range of elements (function template) | |
sorts a range of elements while preserving order between equal elements (function template) | |
partially sorts the given range making sure that it is partitioned by the given element (function template) | |
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) | |
returns an iterator to the first element greater than a certain value (function template) | |
determines if an element exists in a certain range (function template) | |
returns range of elements matching a specific key (function template) | |
Set operations (on sorted ranges) | |
Defined in namespace
std::experimental::ranges | |
merges two sorted ranges (function template) | |
merges two ordered ranges in-place (function template) | |
returns true if one set is a subset of another (function template) | |
computes the difference between two sets (function template) | |
computes the intersection of two sets (function template) | |
computes the symmetric difference between two sets (function template) | |
computes the union of two sets (function template) | |
Heap operations | |
Defined in namespace
std::experimental::ranges | |
checks if the given range is a max heap (function template) | |
finds the largest subrange that is a max heap (function template) | |
creates a max heap out of a range of elements (function template) | |
adds an element to a max heap (function template) | |
removes the largest element from a max heap (function template) | |
turns a max heap into a range of elements sorted in ascending order (function template) | |
Minimum/maximum operations | |
Defined in namespace
std::experimental::ranges | |
returns the greater of the given values (function template) | |
returns the largest element in a range (function template) | |
returns the smaller of the given values (function template) | |
returns the smallest element in a range (function template) | |
returns the smaller and larger of two elements (function template) | |
returns the smallest and the largest elements in a range (function template) | |
Permutation operations | |
Defined in namespace
std::experimental::ranges | |
determines if a sequence is a permutation of another sequence (function template) | |
generates the next greater lexicographic permutation of a range of elements (function template) | |
generates the next smaller lexicographic permutation of a range of elements (function template) |