From cff526187eed699537716bfc1f974c393d6a247b Mon Sep 17 00:00:00 2001 From: Jens Maurer Date: Thu, 28 Feb 2019 23:57:13 +0100 Subject: [PATCH 1/2] P1252R2 Ranges Design Cleanup Renamed some suggested stable labels for new sections. --- source/algorithms.tex | 508 ++++++++++++++++++++++++------------------ source/future.tex | 26 +++ source/iterators.tex | 21 +- source/lib-intro.tex | 2 +- source/ranges.tex | 119 ++++++++-- source/utilities.tex | 149 ++----------- 6 files changed, 437 insertions(+), 388 deletions(-) diff --git a/source/algorithms.tex b/source/algorithms.tex index b923639135..bdb7a4cac9 100644 --- a/source/algorithms.tex +++ b/source/algorithms.tex @@ -667,8 +667,20 @@ namespace ranges { template struct for_each_result { - I in; - F fun; + [[no_unique_address]] I in; + [[no_unique_address]] F fun; + + template + requires ConvertibleTo && ConvertibleTo + operator for_each_result() const & { + return {in, fun}; + } + + template + requires ConvertibleTo && ConvertibleTo + operator for_each_result() && { + return {std::move(in), std::move(fun)}; + } }; template S, class Proj = identity, @@ -712,10 +724,10 @@ namespace ranges { template S, class T, class Proj = identity> - requires IndirectRelation, projected, const T*> + requires IndirectRelation, const T*> constexpr I find(I first, S last, const T& value, Proj proj = {}); template - requires IndirectRelation, projected, Proj>, const T*> + requires IndirectRelation, Proj>, const T*> constexpr safe_iterator_t find(R&& r, const T& value, Proj proj = {}); template S, class Proj = identity, @@ -759,13 +771,13 @@ namespace ranges { template S1, ForwardIterator I2, Sentinel S2, - class Pred = ranges::equal_to<>, class Proj1 = identity, class Proj2 = identity> + class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> requires IndirectlyComparable constexpr subrange find_end(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); template, class Proj1 = identity, class Proj2 = identity> + class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> requires IndirectlyComparable, iterator_t, Pred, Proj1, Proj2> constexpr safe_subrange_t find_end(R1&& r1, R2&& r2, Pred pred = {}, @@ -799,13 +811,13 @@ template S1, ForwardIterator I2, Sentinel S2, class Proj1 = identity, class Proj2 = identity, IndirectRelation, - projected> Pred = ranges::equal_to<>> + projected> Pred = ranges::equal_to> constexpr I1 find_first_of(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); template, Proj1>, - projected, Proj2>> Pred = ranges::equal_to<>> + projected, Proj2>> Pred = ranges::equal_to> constexpr safe_iterator_t find_first_of(R1&& r1, R2&& r2, Pred pred = {}, @@ -832,11 +844,11 @@ namespace ranges { template S, class Proj = identity, - IndirectRelation> Pred = ranges::equal_to<>> + IndirectRelation> Pred = ranges::equal_to> constexpr I adjacent_find(I first, S last, Pred pred = {}, Proj proj = {}); template, Proj>> Pred = ranges::equal_to<>> + IndirectRelation, Proj>> Pred = ranges::equal_to> constexpr safe_iterator_t adjacent_find(R&& r, Pred pred = {}, Proj proj = {}); } @@ -859,11 +871,11 @@ namespace ranges { template S, class T, class Proj = identity> - requires IndirectRelation, projected, const T*> + requires IndirectRelation, const T*> constexpr iter_difference_t count(I first, S last, const T& value, Proj proj = {}); template - requires IndirectRelation, projected, Proj>, const T*> + requires IndirectRelation, Proj>, const T*> constexpr iter_difference_t> count(R&& r, const T& value, Proj proj = {}); template S, class Proj = identity, @@ -921,21 +933,33 @@ namespace ranges { template struct mismatch_result { - I1 in1; - I2 in2; + [[no_unique_address]] I1 in1; + [[no_unique_address]] I2 in2; + + template + requires ConvertibleTo && ConvertibleTo + operator mismatch_result() const & { + return {in1, in2}; + } + + template + requires ConvertibleTo && ConvertibleTo + operator mismatch_result() && { + return {std::move(in1), std::move(in2)}; + } }; template S1, InputIterator I2, Sentinel S2, class Proj1 = identity, class Proj2 = identity, IndirectRelation, - projected> Pred = ranges::equal_to<>> + projected> Pred = ranges::equal_to> constexpr mismatch_result mismatch(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); template, Proj1>, - projected, Proj2>> Pred = ranges::equal_to<>> + projected, Proj2>> Pred = ranges::equal_to> constexpr mismatch_result, safe_iterator_t> mismatch(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); @@ -977,12 +1001,12 @@ namespace ranges { template S1, InputIterator I2, Sentinel S2, - class Pred = ranges::equal_to<>, class Proj1 = identity, class Proj2 = identity> + class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> requires IndirectlyComparable constexpr bool equal(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); - template, + template requires IndirectlyComparable, iterator_t, Pred, Proj1, Proj2> constexpr bool equal(R1&& r1, R2&& r2, Pred pred = {}, @@ -1006,13 +1030,13 @@ namespace ranges { template S1, ForwardIterator I2, - Sentinel S2, class Pred = ranges::equal_to<>, class Proj1 = identity, + Sentinel S2, class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> requires IndirectlyComparable constexpr bool is_permutation(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); - template, + template requires IndirectlyComparable, iterator_t, Pred, Proj1, Proj2> constexpr bool is_permutation(R1&& r1, R2&& r2, Pred pred = {}, @@ -1044,13 +1068,13 @@ namespace ranges { template S1, ForwardIterator I2, - Sentinel S2, class Pred = ranges::equal_to<>, + Sentinel S2, class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> requires IndirectlyComparable constexpr subrange search(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); - template, + template requires IndirectlyComparable, iterator_t, Pred, Proj1, Proj2> constexpr safe_subrange_t @@ -1082,12 +1106,12 @@ namespace ranges { template S, class T, - class Pred = ranges::equal_to<>, class Proj = identity> + class Pred = ranges::equal_to, class Proj = identity> requires IndirectlyComparable constexpr subrange search_n(I first, S last, iter_difference_t count, const T& value, Pred pred = {}, Proj proj = {}); - template, + template requires IndirectlyComparable, const T*, Pred, Proj> constexpr safe_subrange_t @@ -1112,8 +1136,20 @@ namespace ranges { template struct copy_result { - I in; - O out; + [[no_unique_address]] I in; + [[no_unique_address]] O out; + + template + requires ConvertibleTo && ConvertibleTo + operator copy_result() const & { + return {in, out}; + } + + template + requires ConvertibleTo && ConvertibleTo + operator copy_result() && { + return {std::move(in), std::move(out)}; + } }; template S, WeaklyIncrementable O> @@ -1300,9 +1336,23 @@ template struct binary_transform_result { - I1 in1; - I2 in2; - O out; + [[no_unique_address]] I1 in1; + [[no_unique_address]] I2 in2; + [[no_unique_address]] O out; + + template + requires ConvertibleTo && + ConvertibleTo && ConvertibleTo + operator binary_transform_result() const & { + return {in1, in2, out}; + } + + template + requires ConvertibleTo && + ConvertibleTo && ConvertibleTo + operator binary_transform_result() && { + return {std::move(in1), std::move(in2), std::move(out)}; + } }; template S1, InputIterator I2, Sentinel S2, @@ -1341,12 +1391,12 @@ namespace ranges { template S, class T1, class T2, class Proj = identity> requires Writable && - IndirectRelation, projected, const T1*> + IndirectRelation, const T1*> constexpr I replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {}); template requires Writable, const T2&> && - IndirectRelation, projected, Proj>, const T1*> + IndirectRelation, Proj>, const T1*> constexpr safe_iterator_t replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {}); template S, class T, class Proj = identity, @@ -1387,14 +1437,14 @@ template S, class T1, class T2, OutputIterator O, class Proj = identity> requires IndirectlyCopyable && - IndirectRelation, projected, const T1*> + IndirectRelation, const T1*> constexpr replace_copy_result replace_copy(I first, S last, O result, const T1& old_value, const T2& new_value, Proj proj = {}); template O, class Proj = identity> requires IndirectlyCopyable, O> && - IndirectRelation, projected, Proj>, const T1*> + IndirectRelation, Proj>, const T1*> constexpr replace_copy_result, O> replace_copy(R&& r, O result, const T1& old_value, const T2& new_value, Proj proj = {}); @@ -1482,11 +1532,11 @@ namespace ranges { template S, class T, class Proj = identity> - requires IndirectRelation, projected, const T*> + requires IndirectRelation, const T*> constexpr I remove(I first, S last, const T& value, Proj proj = {}); template requires Permutable> && - IndirectRelation, projected, Proj>, const T*> + IndirectRelation, Proj>, const T*> constexpr safe_iterator_t remove(R&& r, const T& value, Proj proj = {}); template S, class Proj = identity, @@ -1527,12 +1577,12 @@ template S, WeaklyIncrementable O, class T, class Proj = identity> requires IndirectlyCopyable && - IndirectRelation, projected, const T*> + IndirectRelation, const T*> constexpr remove_copy_result remove_copy(I first, S last, O result, const T& value, Proj proj = {}); template requires IndirectlyCopyable, O> && - IndirectRelation, projected, Proj>, const T*> + IndirectRelation, Proj>, const T*> constexpr remove_copy_result, O> remove_copy(R&& r, O result, const T& value, Proj proj = {}); @@ -1567,10 +1617,10 @@ namespace ranges { template S, class Proj = identity, - IndirectRelation> C = ranges::equal_to<>> + IndirectRelation> C = ranges::equal_to> constexpr I unique(I first, S last, C comp = {}, Proj proj = {}); template, Proj>> C = ranges::equal_to<>> + IndirectRelation, Proj>> C = ranges::equal_to> requires Permutable> constexpr safe_iterator_t unique(R&& r, C comp = {}, Proj proj = {}); @@ -1601,7 +1651,7 @@ using unique_copy_result = copy_result; template S, WeaklyIncrementable O, - class Proj = identity, IndirectRelation> C = ranges::equal_to<>> + class Proj = identity, IndirectRelation> C = ranges::equal_to> requires IndirectlyCopyable && (ForwardIterator || (InputIterator && Same, iter_value_t>) || @@ -1609,7 +1659,7 @@ constexpr unique_copy_result unique_copy(I first, S last, O result, C comp = {}, Proj proj = {}); template, Proj>> C = ranges::equal_to<>> + IndirectRelation, Proj>> C = ranges::equal_to> requires IndirectlyCopyable, O> && (ForwardIterator> || (InputIterator && Same>, iter_value_t>) || @@ -1763,12 +1813,12 @@ Compare comp); namespace ranges { - template S, class Comp = ranges::less<>, + template S, class Comp = ranges::less, class Proj = identity> requires Sortable constexpr I sort(I first, S last, Comp comp = {}, Proj proj = {}); - template, class Proj = identity> + template requires Sortable, Comp, Proj> constexpr safe_iterator_t sort(R&& r, Comp comp = {}, Proj proj = {}); @@ -1788,11 +1838,11 @@ Compare comp); namespace ranges { - template S, class Comp = ranges::less<>, + template S, class Comp = ranges::less, class Proj = identity> requires Sortable I stable_sort(I first, S last, Comp comp = {}, Proj proj = {}); - template, class Proj = identity> + template requires Sortable, Comp, Proj> safe_iterator_t stable_sort(R&& r, Comp comp = {}, Proj proj = {}); @@ -1818,12 +1868,12 @@ RandomAccessIterator last, Compare comp); namespace ranges { - template S, class Comp = ranges::less<>, + template S, class Comp = ranges::less, class Proj = identity> requires Sortable constexpr I partial_sort(I first, I middle, S last, Comp comp = {}, Proj proj = {}); - template, class Proj = identity> + template requires Sortable, Comp, Proj> constexpr safe_iterator_t partial_sort(R&& r, iterator_t middle, Comp comp = {}, @@ -1858,13 +1908,13 @@ namespace ranges { template S1, RandomAccessIterator I2, Sentinel S2, - class Comp = ranges::less<>, class Proj1 = identity, class Proj2 = identity> + class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> requires IndirectlyCopyable && Sortable && IndirectStrictWeakOrder, projected> constexpr I2 partial_sort_copy(I1 first, S1 last, I2 result_first, S2 result_last, Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); - template, + template requires IndirectlyCopyable, iterator_t> && Sortable, Comp, Proj2> && @@ -1890,10 +1940,10 @@ namespace ranges { template S, class Proj = identity, - IndirectStrictWeakOrder> Comp = ranges::less<>> + IndirectStrictWeakOrder> Comp = ranges::less> constexpr bool is_sorted(I first, S last, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = ranges::less<>> + IndirectStrictWeakOrder, Proj>> Comp = ranges::less> constexpr bool is_sorted(R&& r, Comp comp = {}, Proj proj = {}); } @@ -1916,10 +1966,10 @@ namespace ranges { template S, class Proj = identity, - IndirectStrictWeakOrder> Comp = ranges::less<>> + IndirectStrictWeakOrder> Comp = ranges::less> constexpr I is_sorted_until(I first, S last, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = ranges::less<>> + IndirectStrictWeakOrder, Proj>> Comp = ranges::less> constexpr safe_iterator_t is_sorted_until(R&& r, Comp comp = {}, Proj proj = {}); } @@ -1941,12 +1991,12 @@ RandomAccessIterator last, Compare comp); namespace ranges { - template S, class Comp = ranges::less<>, + template S, class Comp = ranges::less, class Proj = identity> requires Sortable constexpr I nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {}); - template, class Proj = identity> + template requires Sortable, Comp, Proj> constexpr safe_iterator_t nth_element(R&& r, iterator_t nth, Comp comp = {}, Proj proj = {}); @@ -1964,12 +2014,12 @@ namespace ranges { template S, class T, class Proj = identity, - IndirectStrictWeakOrder> Comp = ranges::less<>> + IndirectStrictWeakOrder> Comp = ranges::less> constexpr I lower_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = - ranges::less<>> + ranges::less> constexpr safe_iterator_t lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); } @@ -1985,11 +2035,11 @@ namespace ranges { template S, class T, class Proj = identity, - IndirectStrictWeakOrder> Comp = ranges::less<>> + IndirectStrictWeakOrder> Comp = ranges::less> constexpr I upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = - ranges::less<>> + ranges::less> constexpr safe_iterator_t upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); } @@ -2005,12 +2055,12 @@ namespace ranges { template S, class T, class Proj = identity, - IndirectStrictWeakOrder> Comp = ranges::less<>> + IndirectStrictWeakOrder> Comp = ranges::less> constexpr subrange equal_range(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = - ranges::less<>> + ranges::less> constexpr safe_subrange_t equal_range(R&& r, const T& value, Comp comp = {}, Proj proj = {}); } @@ -2026,12 +2076,12 @@ namespace ranges { template S, class T, class Proj = identity, - IndirectStrictWeakOrder> Comp = ranges::less<>> + IndirectStrictWeakOrder> Comp = ranges::less> constexpr bool binary_search(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = - ranges::less<>> + ranges::less> constexpr bool binary_search(R&& r, const T& value, Comp comp = {}, Proj proj = {}); } @@ -2112,9 +2162,23 @@ namespace ranges { template struct partition_copy_result { - I in; - O1 out1; - O2 out2; + [[no_unique_address]] I in; + [[no_unique_address]] O1 out1; + [[no_unique_address]] O2 out2; + + template + requires ConvertibleTo && + ConvertibleTo && ConvertibleTo + operator partition_copy_result() const & { + return {in, out1, out2}; + } + + template + requires ConvertibleTo && + ConvertibleTo && ConvertibleTo + operator partition_copy_result() && { + return {std::move(in), std::move(out1), std::move(out2)}; + } }; template S, WeaklyIncrementable O1, WeaklyIncrementable O2, @@ -2179,13 +2243,13 @@ using merge_result = binary_transform_result; template S1, InputIterator I2, Sentinel S2, - WeaklyIncrementable O, class Comp = ranges::less<>, class Proj1 = identity, + WeaklyIncrementable O, class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> requires Mergeable constexpr merge_result merge(I1 first1, S1 last1, I2 first2, S2 last2, O result, Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); - template, + template requires Mergeable, iterator_t, O, Comp, Proj1, Proj2> constexpr merge_result, safe_iterator_t, O> @@ -2213,11 +2277,11 @@ BidirectionalIterator last, Compare comp); namespace ranges { - template S, class Comp = ranges::less<>, + template S, class Comp = ranges::less, class Proj = identity> requires Sortable I inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {}); - template, class Proj = identity> + template requires Sortable, Comp, Proj> safe_iterator_t inplace_merge(R&& r, iterator_t middle, Comp comp = {}, @@ -2247,13 +2311,13 @@ template S1, InputIterator I2, Sentinel S2, class Proj1 = identity, class Proj2 = identity, IndirectStrictWeakOrder, projected> Comp = - ranges::less<>> + ranges::less> constexpr bool includes(I1 first1, S1 last1, I2 first2, S2 last2, Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); template, Proj1>, - projected, Proj2>> Comp = ranges::less<>> + projected, Proj2>> Comp = ranges::less> constexpr bool includes(R1&& r1, R2&& r2, Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); } @@ -2288,14 +2352,14 @@ using set_union_result = binary_transform_result; template S1, InputIterator I2, Sentinel S2, - WeaklyIncrementable O, class Comp = ranges::less<>, + WeaklyIncrementable O, class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> requires Mergeable constexpr set_union_result set_union(I1 first1, S1 last1, I2 first2, S2 last2, O result, Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); template, class Proj1 = identity, class Proj2 = identity> + class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> requires Mergeable, iterator_t, O, Comp, Proj1, Proj2> constexpr set_union_result, safe_iterator_t, O> set_union(R1&& r1, R2&& r2, O result, Comp comp = {}, @@ -2332,14 +2396,14 @@ using set_intersection_result = binary_transform_result; template S1, InputIterator I2, Sentinel S2, - WeaklyIncrementable O, class Comp = ranges::less<>, + WeaklyIncrementable O, class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> requires Mergeable constexpr set_intersection_result set_intersection(I1 first1, S1 last1, I2 first2, S2 last2, O result, Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); template, class Proj1 = identity, class Proj2 = identity> + class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> requires Mergeable, iterator_t, O, Comp, Proj1, Proj2> constexpr set_intersection_result, safe_iterator_t, O> set_intersection(R1&& r1, R2&& r2, O result, @@ -2376,14 +2440,14 @@ using set_difference_result = copy_result; template S1, InputIterator I2, Sentinel S2, - WeaklyIncrementable O, class Comp = ranges::less<>, + WeaklyIncrementable O, class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> requires Mergeable constexpr set_difference_result set_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result, Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); template, class Proj1 = identity, class Proj2 = identity> + class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> requires Mergeable, iterator_t, O, Comp, Proj1, Proj2> constexpr set_difference_result, O> set_difference(R1&& r1, R2&& r2, O result, @@ -2420,7 +2484,7 @@ using set_symmetric_difference_result = binary_transform_result; template S1, InputIterator I2, Sentinel S2, - WeaklyIncrementable O, class Comp = ranges::less<>, + WeaklyIncrementable O, class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> requires Mergeable constexpr set_symmetric_difference_result @@ -2428,7 +2492,7 @@ Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); template, class Proj1 = identity, class Proj2 = identity> + class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> requires Mergeable, iterator_t, O, Comp, Proj1, Proj2> constexpr set_symmetric_difference_result, safe_iterator_t, O> set_symmetric_difference(R1&& r1, R2&& r2, O result, Comp comp = {}, @@ -2443,12 +2507,12 @@ Compare comp); namespace ranges { - template S, class Comp = ranges::less<>, + template S, class Comp = ranges::less, class Proj = identity> requires Sortable constexpr I push_heap(I first, S last, Comp comp = {}, Proj proj = {}); - template, class Proj = identity> + template requires Sortable, Comp, Proj> constexpr safe_iterator_t push_heap(R&& r, Comp comp = {}, Proj proj = {}); @@ -2461,12 +2525,12 @@ Compare comp); namespace ranges { - template S, class Comp = ranges::less<>, + template S, class Comp = ranges::less, class Proj = identity> requires Sortable constexpr I pop_heap(I first, S last, Comp comp = {}, Proj proj = {}); - template, class Proj = identity> + template requires Sortable, Comp, Proj> constexpr safe_iterator_t pop_heap(R&& r, Comp comp = {}, Proj proj = {}); @@ -2479,12 +2543,12 @@ Compare comp); namespace ranges { - template S, class Comp = ranges::less<>, + template S, class Comp = ranges::less, class Proj = identity> requires Sortable constexpr I make_heap(I first, S last, Comp comp = {}, Proj proj = {}); - template, class Proj = identity> + template requires Sortable, Comp, Proj> constexpr safe_iterator_t make_heap(R&& r, Comp comp = {}, Proj proj = {}); @@ -2497,12 +2561,12 @@ Compare comp); namespace ranges { - template S, class Comp = ranges::less<>, + template S, class Comp = ranges::less, class Proj = identity> requires Sortable constexpr I sort_heap(I first, S last, Comp comp = {}, Proj proj = {}); - template, class Proj = identity> + template requires Sortable, Comp, Proj> constexpr safe_iterator_t sort_heap(R&& r, Comp comp = {}, Proj proj = {}); @@ -2523,10 +2587,10 @@ namespace ranges { template S, class Proj = identity, - IndirectStrictWeakOrder> Comp = ranges::less<>> + IndirectStrictWeakOrder> Comp = ranges::less> constexpr bool is_heap(I first, S last, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = ranges::less<>> + IndirectStrictWeakOrder, Proj>> Comp = ranges::less> constexpr bool is_heap(R&& r, Comp comp = {}, Proj proj = {}); } @@ -2549,10 +2613,10 @@ namespace ranges { template S, class Proj = identity, - IndirectStrictWeakOrder> Comp = ranges::less<>> + IndirectStrictWeakOrder> Comp = ranges::less> constexpr I is_heap_until(I first, S last, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = ranges::less<>> + IndirectStrictWeakOrder, Proj>> Comp = ranges::less> constexpr safe_iterator_t is_heap_until(R&& r, Comp comp = {}, Proj proj = {}); } @@ -2568,13 +2632,13 @@ namespace ranges { template> Comp = ranges::less<>> + IndirectStrictWeakOrder> Comp = ranges::less> constexpr const T& min(const T& a, const T& b, Comp comp = {}, Proj proj = {}); template> Comp = ranges::less<>> + IndirectStrictWeakOrder> Comp = ranges::less> constexpr T min(initializer_list r, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = ranges::less<>> + IndirectStrictWeakOrder, Proj>> Comp = ranges::less> requires IndirectlyCopyableStorable, iter_value_t>*> constexpr iter_value_t> min(R&& r, Comp comp = {}, Proj proj = {}); @@ -2590,13 +2654,13 @@ namespace ranges { template> Comp = ranges::less<>> + IndirectStrictWeakOrder> Comp = ranges::less> constexpr const T& max(const T& a, const T& b, Comp comp = {}, Proj proj = {}); template> Comp = ranges::less<>> + IndirectStrictWeakOrder> Comp = ranges::less> constexpr T max(initializer_list r, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = ranges::less<>> + IndirectStrictWeakOrder, Proj>> Comp = ranges::less> requires IndirectlyCopyableStorable, iter_value_t>*> constexpr iter_value_t> max(R&& r, Comp comp = {}, Proj proj = {}); @@ -2613,20 +2677,32 @@ namespace ranges { template struct minmax_result { - T min; - T max; + [[no_unique_address]] T min; + [[no_unique_address]] T max; + + template + requires ConvertibleTo + operator minmax_result() const & { + return {min, max}; + } + + template + requires ConvertibleTo + operator minmax_result() && { + return {std::move(min), std::move(max)}; + } }; template> Comp = ranges::less<>> + IndirectStrictWeakOrder> Comp = ranges::less> constexpr minmax_result minmax(const T& a, const T& b, Comp comp = {}, Proj proj = {}); template> Comp = ranges::less<>> + IndirectStrictWeakOrder> Comp = ranges::less> constexpr minmax_result minmax(initializer_list r, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = ranges::less<>> + IndirectStrictWeakOrder, Proj>> Comp = ranges::less> requires IndirectlyCopyableStorable, iter_value_t>*> constexpr minmax_result>> minmax(R&& r, Comp comp = {}, Proj proj = {}); @@ -2647,10 +2723,10 @@ namespace ranges { template S, class Proj = identity, - IndirectStrictWeakOrder> Comp = ranges::less<>> + IndirectStrictWeakOrder> Comp = ranges::less> constexpr I min_element(I first, S last, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = ranges::less<>> + IndirectStrictWeakOrder, Proj>> Comp = ranges::less> constexpr safe_iterator_t min_element(R&& r, Comp comp = {}, Proj proj = {}); } @@ -2670,10 +2746,10 @@ namespace ranges { template S, class Proj = identity, - IndirectStrictWeakOrder> Comp = ranges::less<>> + IndirectStrictWeakOrder> Comp = ranges::less> constexpr I max_element(I first, S last, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = ranges::less<>> + IndirectStrictWeakOrder, Proj>> Comp = ranges::less> constexpr safe_iterator_t max_element(R&& r, Comp comp = {}, Proj proj = {}); } @@ -2698,11 +2774,11 @@ using minmax_element_result = minmax_result; template S, class Proj = identity, - IndirectStrictWeakOrder> Comp = ranges::less<>> + IndirectStrictWeakOrder> Comp = ranges::less> constexpr minmax_element_result minmax_element(I first, S last, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = ranges::less<>> + IndirectStrictWeakOrder, Proj>> Comp = ranges::less> constexpr minmax_element_result> minmax_element(R&& r, Comp comp = {}, Proj proj = {}); } @@ -2740,14 +2816,14 @@ template S1, InputIterator I2, Sentinel S2, class Proj1 = identity, class Proj2 = identity, IndirectStrictWeakOrder, projected> Comp = - ranges::less<>> + ranges::less> constexpr bool lexicographical_compare(I1 first1, S1 last1, I2 first2, S2 last2, Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); template, Proj1>, - projected, Proj2>> Comp = ranges::less<>> + projected, Proj2>> Comp = ranges::less> constexpr bool lexicographical_compare(R1&& r1, R2&& r2, Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); @@ -2776,12 +2852,12 @@ BidirectionalIterator last, Compare comp); namespace ranges { - template S, class Comp = ranges::less<>, + template S, class Comp = ranges::less, class Proj = identity> requires Sortable constexpr bool next_permutation(I first, S last, Comp comp = {}, Proj proj = {}); - template, + template requires Sortable, Comp, Proj> constexpr bool @@ -2796,12 +2872,12 @@ BidirectionalIterator last, Compare comp); namespace ranges { - template S, class Comp = ranges::less<>, + template S, class Comp = ranges::less, class Proj = identity> requires Sortable constexpr bool prev_permutation(I first, S last, Comp comp = {}, Proj proj = {}); - template, + template requires Sortable, Comp, Proj> constexpr bool @@ -3148,10 +3224,10 @@ namespace ranges { template S, class T, class Proj = identity> - requires IndirectRelation, projected, const T*> + requires IndirectRelation, const T*> constexpr I find(I first, S last, const T& value, Proj proj = {}); template - requires IndirectRelation, projected, Proj>, const T*> + requires IndirectRelation, Proj>, const T*> constexpr safe_iterator_t find(R&& r, const T& value, Proj proj = {}); template S, class Proj = identity, @@ -3225,13 +3301,13 @@ namespace ranges { template S1, ForwardIterator I2, Sentinel S2, - class Pred = ranges::equal_to<>, class Proj1 = identity, class Proj2 = identity> + class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> requires IndirectlyComparable constexpr subrange find_end(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); template, class Proj1 = identity, class Proj2 = identity> + class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> requires IndirectlyComparable, iterator_t, Pred, Proj1, Proj2> constexpr safe_subrange_t find_end(R1&& r1, R2&& r2, Pred pred = {}, @@ -3314,14 +3390,14 @@ template S1, ForwardIterator I2, Sentinel S2, class Proj1 = identity, class Proj2 = identity, IndirectRelation, - projected> Pred = ranges::equal_to<>> + projected> Pred = ranges::equal_to> constexpr I1 find_first_of(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); template, Proj1>, - projected, Proj2>> Pred = ranges::equal_to<>> + projected, Proj2>> Pred = ranges::equal_to> constexpr safe_iterator_t find_first_of(R1&& r1, R2&& r2, Pred pred = {}, @@ -3381,11 +3457,11 @@ namespace ranges { template S, class Proj = identity, - IndirectRelation> Pred = ranges::equal_to<>> + IndirectRelation> Pred = ranges::equal_to> constexpr I adjacent_find(I first, S last, Pred pred = {}, Proj proj = {}); template, Proj>> Pred = ranges::equal_to<>> + IndirectRelation, Proj>> Pred = ranges::equal_to> constexpr safe_iterator_t adjacent_find(R&& r, Pred pred = {}, Proj proj = {}); } @@ -3442,11 +3518,11 @@ namespace ranges { template S, class T, class Proj = identity> - requires IndirectRelation, projected, const T*> + requires IndirectRelation, const T*> constexpr iter_difference_t count(I first, S last, const T& value, Proj proj = {}); template - requires IndirectRelation, projected, Proj>, const T*> + requires IndirectRelation, Proj>, const T*> constexpr iter_difference_t> count(R&& r, const T& value, Proj proj = {}); template S, class Proj = identity, @@ -3543,14 +3619,14 @@ template S1, InputIterator I2, Sentinel S2, class Proj1 = identity, class Proj2 = identity, IndirectRelation, - projected> Pred = ranges::equal_to<>> + projected> Pred = ranges::equal_to> constexpr mismatch_result mismatch(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); template, Proj1>, - projected, Proj2>> Pred = ranges::equal_to<>> + projected, Proj2>> Pred = ranges::equal_to> constexpr mismatch_result, safe_iterator_t> mismatch(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); @@ -3635,12 +3711,12 @@ namespace ranges { template S1, InputIterator I2, Sentinel S2, - class Pred = ranges::equal_to<>, class Proj1 = identity, class Proj2 = identity> + class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> requires IndirectlyComparable constexpr bool equal(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); - template, + template requires IndirectlyComparable, iterator_t, Pred, Proj1, Proj2> constexpr bool equal(R1&& r1, R2&& r2, Pred pred = {}, @@ -3768,13 +3844,13 @@ \begin{itemdecl} namespace ranges { template S1, ForwardIterator I2, - Sentinel S2, class Pred = ranges::equal_to<>, class Proj1 = identity, + Sentinel S2, class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> requires IndirectlyComparable constexpr bool is_permutation(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); - template, + template requires IndirectlyComparable, iterator_t, Pred, Proj1, Proj2> constexpr bool is_permutation(R1&& r1, R2&& r2, Pred pred = {}, @@ -3858,13 +3934,13 @@ \begin{itemdecl} namespace ranges { template S1, ForwardIterator I2, - Sentinel S2, class Pred = ranges::equal_to<>, + Sentinel S2, class Pred = ranges::equal_to, class Proj1 = identity, class Proj2 = identity> requires IndirectlyComparable constexpr subrange search(I1 first1, S1 last1, I2 first2, S2 last2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); - template, + template requires IndirectlyComparable, iterator_t, Pred, Proj1, Proj2> constexpr safe_subrange_t @@ -3948,12 +4024,12 @@ \begin{itemdecl} namespace ranges { template S, class T, - class Pred = ranges::equal_to<>, class Proj = identity> + class Pred = ranges::equal_to, class Proj = identity> requires IndirectlyComparable constexpr subrange search_n(I first, S last, iter_difference_t count, const T& value, Pred pred = {}, Proj proj = {}); - template, + template requires IndirectlyComparable, const T*, Pred, Proj> constexpr safe_subrange_t @@ -4649,12 +4725,12 @@ namespace ranges { template S, class T1, class T2, class Proj = identity> requires Writable && - IndirectRelation, projected, const T1*> + IndirectRelation, const T1*> constexpr I replace(I first, S last, const T1& old_value, const T2& new_value, Proj proj = {}); template requires Writable, const T2&> && - IndirectRelation, projected, Proj>, const T1*> + IndirectRelation, Proj>, const T1*> constexpr safe_iterator_t replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {}); template S, class T, class Proj = identity, @@ -4731,14 +4807,14 @@ template S, class T1, class T2, OutputIterator O, class Proj = identity> requires IndirectlyCopyable && - IndirectRelation, projected, const T1*> + IndirectRelation, const T1*> constexpr replace_copy_result replace_copy(I first, S last, O result, const T1& old_value, const T2& new_value, Proj proj = {}); template O, class Proj = identity> requires IndirectlyCopyable, O> && - IndirectRelation, projected, Proj>, const T1*> + IndirectRelation, Proj>, const T1*> constexpr replace_copy_result, O> replace_copy(R&& r, O result, const T1& old_value, const T2& new_value, Proj proj = {}); @@ -4938,11 +5014,11 @@ namespace ranges { template S, class T, class Proj = identity> - requires IndirectRelation, projected, const T*> + requires IndirectRelation, const T*> constexpr I remove(I first, S last, const T& value, Proj proj = {}); template requires Permutable> && - IndirectRelation, projected, Proj>, const T*> + IndirectRelation, Proj>, const T*> constexpr safe_iterator_t remove(R&& r, const T& value, Proj proj = {}); template S, class Proj = identity, @@ -5029,12 +5105,12 @@ template S, WeaklyIncrementable O, class T, class Proj = identity> requires IndirectlyCopyable && - IndirectRelation, projected, const T*> + IndirectRelation, const T*> constexpr remove_copy_result remove_copy(I first, S last, O result, const T& value, Proj proj = {}); template requires IndirectlyCopyable, O> && - IndirectRelation, projected, Proj>, const T*> + IndirectRelation, Proj>, const T*> constexpr remove_copy_result, O> remove_copy(R&& r, O result, const T& value, Proj proj = {}); template S, WeaklyIncrementable O, @@ -5117,10 +5193,10 @@ namespace ranges { template S, class Proj = identity, - IndirectRelation> C = ranges::equal_to<>> + IndirectRelation> C = ranges::equal_to> constexpr I unique(I first, S last, C comp = {}, Proj proj = {}); template, Proj>> C = ranges::equal_to<>> + IndirectRelation, Proj>> C = ranges::equal_to> requires Permutable> constexpr safe_iterator_t unique(R&& r, C comp = {}, Proj proj = {}); @@ -5193,7 +5269,7 @@ namespace ranges { template S, WeaklyIncrementable O, - class Proj = identity, IndirectRelation> C = ranges::equal_to<>> + class Proj = identity, IndirectRelation> C = ranges::equal_to> requires IndirectlyCopyable && (ForwardIterator || (InputIterator && Same, iter_value_t>) || @@ -5201,7 +5277,7 @@ constexpr unique_copy_result unique_copy(I first, S last, O result, C comp = {}, Proj proj = {}); template, Proj>> C = ranges::equal_to<>> + IndirectRelation, Proj>> C = ranges::equal_to> requires IndirectlyCopyable, O> && (ForwardIterator> || (InputIterator && Same>, iter_value_t>) || @@ -5830,12 +5906,12 @@ Compare comp); namespace ranges { - template S, class Comp = ranges::less<>, + template S, class Comp = ranges::less, class Proj = identity> requires Sortable constexpr I sort(I first, S last, Comp comp = {}, Proj proj = {}); - template, class Proj = identity> + template requires Sortable, Comp, Proj> constexpr safe_iterator_t sort(R&& r, Comp comp = {}, Proj proj = {}); @@ -5891,11 +5967,11 @@ Compare comp); namespace ranges { - template S, class Comp = ranges::less<>, + template S, class Comp = ranges::less, class Proj = identity> requires Sortable I stable_sort(I first, S last, Comp comp = {}, Proj proj = {}); - template, class Proj = identity> + template requires Sortable, Comp, Proj> safe_iterator_t stable_sort(R&& r, Comp comp = {}, Proj proj = {}); @@ -5965,7 +6041,7 @@ Compare comp); namespace ranges { - template S, class Comp = ranges::less<>, + template S, class Comp = ranges::less, class Proj = identity> requires Sortable constexpr I @@ -6011,7 +6087,7 @@ \begin{itemdecl} namespace ranges { - template, class Proj = identity> + template requires Sortable, Comp, Proj> constexpr safe_iterator_t partial_sort(R&& r, iterator_t middle, Comp comp = {}, Proj proj = {}); @@ -6061,13 +6137,13 @@ namespace ranges { template S1, RandomAccessIterator I2, Sentinel S2, - class Comp = ranges::less<>, class Proj1 = identity, class Proj2 = identity> + class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> requires IndirectlyCopyable && Sortable && IndirectStrictWeakOrder, projected> constexpr I2 partial_sort_copy(I1 first, S1 last, I2 result_first, S2 result_last, Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); - template, + template requires IndirectlyCopyable, iterator_t> && Sortable, Comp, Proj2> && @@ -6195,10 +6271,10 @@ \begin{itemdecl} namespace ranges { template S, class Proj = identity, - IndirectStrictWeakOrder> Comp = ranges::less<>> + IndirectStrictWeakOrder> Comp = ranges::less> constexpr bool is_sorted(I first, S last, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = ranges::less<>> + IndirectStrictWeakOrder, Proj>> Comp = ranges::less> constexpr bool is_sorted(R&& r, Comp comp = {}, Proj proj = {}); } \end{itemdecl} @@ -6232,10 +6308,10 @@ namespace ranges { template S, class Proj = identity, - IndirectStrictWeakOrder> Comp = ranges::less<>> + IndirectStrictWeakOrder> Comp = ranges::less> constexpr I is_sorted_until(I first, S last, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = ranges::less<>> + IndirectStrictWeakOrder, Proj>> Comp = ranges::less> constexpr safe_iterator_t is_sorted_until(R&& r, Comp comp = {}, Proj proj = {}); } @@ -6279,7 +6355,7 @@ RandomAccessIterator last, Compare comp); namespace ranges { - template S, class Comp = ranges::less<>, + template S, class Comp = ranges::less, class Proj = identity> requires Sortable constexpr I @@ -6327,7 +6403,7 @@ \begin{itemdecl} namespace ranges { - template, class Proj = identity> + template requires Sortable, Comp, Proj> constexpr safe_iterator_t nth_element(R&& r, iterator_t nth, Comp comp = {}, Proj proj = {}); @@ -6373,12 +6449,12 @@ namespace ranges { template S, class T, class Proj = identity, - IndirectStrictWeakOrder> Comp = ranges::less<>> + IndirectStrictWeakOrder> Comp = ranges::less> constexpr I lower_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = - ranges::less<>> + ranges::less> constexpr safe_iterator_t lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); } @@ -6423,11 +6499,11 @@ namespace ranges { template S, class T, class Proj = identity, - IndirectStrictWeakOrder> Comp = ranges::less<>> + IndirectStrictWeakOrder> Comp = ranges::less> constexpr I upper_bound(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = - ranges::less<>> + ranges::less> constexpr safe_iterator_t upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); } @@ -6473,12 +6549,12 @@ namespace ranges { template S, class T, class Proj = identity, - IndirectStrictWeakOrder> Comp = ranges::less<>> + IndirectStrictWeakOrder> Comp = ranges::less> constexpr subrange equal_range(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = - ranges::less<>> + ranges::less> constexpr safe_subrange_t equal_range(R&& r, const T& value, Comp comp = {}, Proj proj = {}); } @@ -6537,12 +6613,12 @@ namespace ranges { template S, class T, class Proj = identity, - IndirectStrictWeakOrder> Comp = ranges::less<>> + IndirectStrictWeakOrder> Comp = ranges::less> constexpr bool binary_search(I first, S last, const T& value, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = - ranges::less<>> + ranges::less> constexpr bool binary_search(R&& r, const T& value, Comp comp = {}, Proj proj = {}); } @@ -6890,13 +6966,13 @@ namespace ranges { template S1, InputIterator I2, Sentinel S2, - WeaklyIncrementable O, class Comp = ranges::less<>, class Proj1 = identity, + WeaklyIncrementable O, class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> requires Mergeable constexpr merge_result merge(I1 first1, S1 last1, I2 first2, S2 last2, O result, Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); - template, + template requires Mergeable, iterator_t, O, Comp, Proj1, Proj2> constexpr merge_result, safe_iterator_t, O> @@ -6982,7 +7058,7 @@ BidirectionalIterator last, Compare comp); namespace ranges { - template S, class Comp = ranges::less<>, + template S, class Comp = ranges::less, class Proj = identity> requires Sortable I inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {}); @@ -7036,7 +7112,7 @@ \begin{itemdecl} namespace ranges { - template, class Proj = identity> + template requires Sortable, Comp, Proj> safe_iterator_t inplace_merge(R&& r, iterator_t middle, Comp comp = {}, Proj proj = {}); @@ -7089,13 +7165,13 @@ template S1, InputIterator I2, Sentinel S2, class Proj1 = identity, class Proj2 = identity, IndirectStrictWeakOrder, - projected> Comp = ranges::less<>> + projected> Comp = ranges::less> constexpr bool includes(I1 first1, S1 last1, I2 first2, S2 last2, Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); template, Proj1>, - projected, Proj2>> Comp = ranges::less<>> + projected, Proj2>> Comp = ranges::less> constexpr bool includes(R1&& r1, R2&& r2, Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); } @@ -7163,14 +7239,14 @@ namespace ranges { template S1, InputIterator I2, Sentinel S2, - WeaklyIncrementable O, class Comp = ranges::less<>, + WeaklyIncrementable O, class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> requires Mergeable constexpr set_union_result set_union(I1 first1, S1 last1, I2 first2, S2 last2, O result, Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); template, class Proj1 = identity, class Proj2 = identity> + class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> requires Mergeable, iterator_t, O, Comp, Proj1, Proj2> constexpr set_union_result, safe_iterator_t, O> set_union(R1&& r1, R2&& r2, O result, Comp comp = {}, @@ -7260,14 +7336,14 @@ namespace ranges { template S1, InputIterator I2, Sentinel S2, - WeaklyIncrementable O, class Comp = ranges::less<>, + WeaklyIncrementable O, class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> requires Mergeable constexpr set_intersection_result set_intersection(I1 first1, S1 last1, I2 first2, S2 last2, O result, Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); template, class Proj1 = identity, class Proj2 = identity> + class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> requires Mergeable, iterator_t, O, Comp, Proj1, Proj2> constexpr set_intersection_result, safe_iterator_t, O> set_intersection(R1&& r1, R2&& r2, O result, @@ -7355,14 +7431,14 @@ namespace ranges { template S1, InputIterator I2, Sentinel S2, - WeaklyIncrementable O, class Comp = ranges::less<>, + WeaklyIncrementable O, class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> requires Mergeable constexpr set_difference_result set_difference(I1 first1, S1 last1, I2 first2, S2 last2, O result, Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); template, class Proj1 = identity, class Proj2 = identity> + class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> requires Mergeable, iterator_t, O, Comp, Proj1, Proj2> constexpr set_difference_result, O> set_difference(R1&& r1, R2&& r2, O result, @@ -7451,7 +7527,7 @@ namespace ranges { template S1, InputIterator I2, Sentinel S2, - WeaklyIncrementable O, class Comp = ranges::less<>, + WeaklyIncrementable O, class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> requires Mergeable constexpr set_symmetric_difference_result @@ -7459,7 +7535,7 @@ Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); template, class Proj1 = identity, class Proj2 = identity> + class Comp = ranges::less, class Proj1 = identity, class Proj2 = identity> requires Mergeable, iterator_t, O, Comp, Proj1, Proj2> constexpr set_symmetric_difference_result, safe_iterator_t, O> set_symmetric_difference(R1&& r1, R2&& r2, O result, Comp comp = {}, @@ -7559,12 +7635,12 @@ Compare comp); namespace ranges { - template S, class Comp = ranges::less<>, + template S, class Comp = ranges::less, class Proj = identity> requires Sortable constexpr I push_heap(I first, S last, Comp comp = {}, Proj proj = {}); - template, class Proj = identity> + template requires Sortable, Comp, Proj> constexpr safe_iterator_t push_heap(R&& r, Comp comp = {}, Proj proj = {}); @@ -7612,12 +7688,12 @@ Compare comp); namespace ranges { - template S, class Comp = ranges::less<>, + template S, class Comp = ranges::less, class Proj = identity> requires Sortable constexpr I pop_heap(I first, S last, Comp comp = {}, Proj proj = {}); - template, class Proj = identity> + template requires Sortable, Comp, Proj> constexpr safe_iterator_t pop_heap(R&& r, Comp comp = {}, Proj proj = {}); @@ -7672,12 +7748,12 @@ Compare comp); namespace ranges { - template S, class Comp = ranges::less<>, + template S, class Comp = ranges::less, class Proj = identity> requires Sortable constexpr I make_heap(I first, S last, Comp comp = {}, Proj proj = {}); - template, class Proj = identity> + template requires Sortable, Comp, Proj> constexpr safe_iterator_t make_heap(R&& r, Comp comp = {}, Proj proj = {}); @@ -7723,12 +7799,12 @@ Compare comp); namespace ranges { - template S, class Comp = ranges::less<>, + template S, class Comp = ranges::less, class Proj = identity> requires Sortable constexpr I sort_heap(I first, S last, Comp comp = {}, Proj proj = {}); - template, class Proj = identity> + template requires Sortable, Comp, Proj> constexpr safe_iterator_t sort_heap(R&& r, Comp comp = {}, Proj proj = {}); @@ -7831,10 +7907,10 @@ \begin{itemdecl} namespace ranges { template S, class Proj = identity, - IndirectStrictWeakOrder> Comp = ranges::less<>> + IndirectStrictWeakOrder> Comp = ranges::less> constexpr bool is_heap(I first, S last, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = ranges::less<>> + IndirectStrictWeakOrder, Proj>> Comp = ranges::less> constexpr bool is_heap(R&& r, Comp comp = {}, Proj proj = {}); } \end{itemdecl} @@ -7868,10 +7944,10 @@ namespace ranges { template S, class Proj = identity, - IndirectStrictWeakOrder> Comp = ranges::less<>> + IndirectStrictWeakOrder> Comp = ranges::less> constexpr I is_heap_until(I first, S last, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = ranges::less<>> + IndirectStrictWeakOrder, Proj>> Comp = ranges::less> constexpr safe_iterator_t is_heap_until(R&& r, Comp comp = {}, Proj proj = {}); } @@ -7906,7 +7982,7 @@ namespace ranges { template> Comp = ranges::less<>> + IndirectStrictWeakOrder> Comp = ranges::less> constexpr const T& min(const T& a, const T& b, Comp comp = {}, Proj proj = {}); } \end{itemdecl} @@ -7942,10 +8018,10 @@ namespace ranges { template> Comp = ranges::less<>> + IndirectStrictWeakOrder> Comp = ranges::less> constexpr T min(initializer_list r, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = ranges::less<>> + IndirectStrictWeakOrder, Proj>> Comp = ranges::less> requires IndirectlyCopyableStorable, iter_value_t>*> constexpr iter_value_t> min(R&& r, Comp comp = {}, Proj proj = {}); @@ -7987,7 +8063,7 @@ namespace ranges { template> Comp = ranges::less<>> + IndirectStrictWeakOrder> Comp = ranges::less> constexpr const T& max(const T& a, const T& b, Comp comp = {}, Proj proj = {}); } \end{itemdecl} @@ -8023,10 +8099,10 @@ namespace ranges { template> Comp = ranges::less<>> + IndirectStrictWeakOrder> Comp = ranges::less> constexpr T max(initializer_list r, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = ranges::less<>> + IndirectStrictWeakOrder, Proj>> Comp = ranges::less> requires IndirectlyCopyableStorable, iter_value_t>*> constexpr iter_value_t> max(R&& r, Comp comp = {}, Proj proj = {}); @@ -8068,7 +8144,7 @@ namespace ranges { template> Comp = ranges::less<>> + IndirectStrictWeakOrder> Comp = ranges::less> constexpr minmax_result minmax(const T& a, const T& b, Comp comp = {}, Proj proj = {}); } @@ -8106,11 +8182,11 @@ namespace ranges { template> Comp = ranges::less<>> + IndirectStrictWeakOrder> Comp = ranges::less> constexpr minmax_result minmax(initializer_list r, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = ranges::less<>> + IndirectStrictWeakOrder, Proj>> Comp = ranges::less> requires IndirectlyCopyableStorable, iter_value_t>*> constexpr minmax_result>> minmax(R&& r, Comp comp = {}, Proj proj = {}); @@ -8165,10 +8241,10 @@ namespace ranges { template S, class Proj = identity, - IndirectStrictWeakOrder> Comp = ranges::less<>> + IndirectStrictWeakOrder> Comp = ranges::less> constexpr I min_element(I first, S last, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = ranges::less<>> + IndirectStrictWeakOrder, Proj>> Comp = ranges::less> constexpr safe_iterator_t min_element(R&& r, Comp comp = {}, Proj proj = {}); } @@ -8214,10 +8290,10 @@ namespace ranges { template S, class Proj = identity, - IndirectStrictWeakOrder> Comp = ranges::less<>> + IndirectStrictWeakOrder> Comp = ranges::less> constexpr I max_element(I first, S last, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = ranges::less<>> + IndirectStrictWeakOrder, Proj>> Comp = ranges::less> constexpr safe_iterator_t max_element(R&& r, Comp comp = {}, Proj proj = {}); } @@ -8265,11 +8341,11 @@ namespace ranges { template S, class Proj = identity, - IndirectStrictWeakOrder> Comp = ranges::less<>> + IndirectStrictWeakOrder> Comp = ranges::less> constexpr minmax_result minmax_element(I first, S last, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = ranges::less<>> + IndirectStrictWeakOrder, Proj>> Comp = ranges::less> constexpr minmax_result> minmax_element(R&& r, Comp comp = {}, Proj proj = {}); } @@ -8357,14 +8433,14 @@ template S1, InputIterator I2, Sentinel S2, class Proj1 = identity, class Proj2 = identity, IndirectStrictWeakOrder, - projected> Comp = ranges::less<>> + projected> Comp = ranges::less> constexpr bool lexicographical_compare(I1 first1, S1 last1, I2 first2, S2 last2, Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); template, Proj1>, - projected, Proj2>> Comp = ranges::less<>> + projected, Proj2>> Comp = ranges::less> constexpr bool lexicographical_compare(R1&& r1, R2&& r2, Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); @@ -8512,12 +8588,12 @@ BidirectionalIterator last, Compare comp); namespace ranges { - template S, class Comp = ranges::less<>, + template S, class Comp = ranges::less, class Proj = identity> requires Sortable constexpr bool next_permutation(I first, S last, Comp comp = {}, Proj proj = {}); - template, + template requires Sortable, Comp, Proj> constexpr bool @@ -8567,12 +8643,12 @@ BidirectionalIterator last, Compare comp); namespace ranges { - template S, class Comp = ranges::less<>, + template S, class Comp = ranges::less, class Proj = identity> requires Sortable constexpr bool prev_permutation(I first, S last, Comp comp = {}, Proj proj = {}); - template, + template requires Sortable, Comp, Proj> constexpr bool diff --git a/source/future.tex b/source/future.tex index dd1deff5ed..ad16437031 100644 --- a/source/future.tex +++ b/source/future.tex @@ -1515,6 +1515,32 @@ \end{codeblock} \end{example} +\rSec1[depr.move.iter.elem]{Deprecated \tcode{move_iterator} access} + +\pnum +The following member is declared in addition to those members +specified in \ref{move.iter.elem}: + +\begin{codeblock} +namespace std { + template + class move_iterator { + public: + constexpr pointer operator->() const; + }; +} +\end{codeblock} + +\indexlibrarymember{operator->}{move_iterator}% +\begin{itemdecl} +constexpr pointer operator->() const; +\end{itemdecl} + +\begin{itemdescr} +\pnum +\returns \tcode{current}. +\end{itemdescr} + \rSec1[depr.util.smartptr.shared.atomic]{Deprecated \tcode{shared_ptr} atomic access} \pnum diff --git a/source/iterators.tex b/source/iterators.tex index 6520a88bad..dd03d00a5d 100644 --- a/source/iterators.tex +++ b/source/iterators.tex @@ -197,11 +197,11 @@ // \ref{alg.req.mergeable}, concept \tcode{Mergeable} template, class P1 = identity, class P2 = identity> + class R = ranges::less, class P1 = identity, class P2 = identity> concept Mergeable = @\seebelow@; // \ref{alg.req.sortable}, concept \tcode{Sortable} - template, class P = identity> + template concept Sortable = @\seebelow@; // \ref{iterator.primitives}, primitives @@ -2277,7 +2277,7 @@ \pnum \begin{note} -The \tcode{ranges::less<>} function object type +The \tcode{ranges::less} function object type used in the concepts below imposes constraints on the concepts' arguments in addition to those that appear in the concepts' bodies\iref{range.cmp}. \end{note} @@ -2428,7 +2428,7 @@ \indexlibrary{\idxcode{Mergeable}}% \begin{codeblock} -template, +template concept Mergeable = InputIterator && @@ -2447,7 +2447,7 @@ \indexlibrary{\idxcode{Sortable}}% \begin{codeblock} -template, class P = identity> +template concept Sortable = Permutable && IndirectStrictWeakOrder>; @@ -3909,7 +3909,6 @@ constexpr iterator_type base() const; constexpr reference operator*() const; - constexpr pointer operator->() const; constexpr move_iterator& operator++(); constexpr auto operator++(int); @@ -4062,16 +4061,6 @@ \effects Equivalent to: \tcode{return ranges::iter_move(current);} \end{itemdescr} -\indexlibrarymember{operator->}{move_iterator}% -\begin{itemdecl} -constexpr pointer operator->() const; -\end{itemdecl} - -\begin{itemdescr} -\pnum -\returns \tcode{current}. -\end{itemdescr} - \indexlibrarymember{operator[]}{move_iterator}% \begin{itemdecl} constexpr reference operator[](difference_type n) const; diff --git a/source/lib-intro.tex b/source/lib-intro.tex index 4e0ce002fa..02141c4041 100644 --- a/source/lib-intro.tex +++ b/source/lib-intro.tex @@ -338,7 +338,7 @@ \begin{example} \begin{codeblock} std::pair pairs[] = {{2, "foo"}, {1, "bar"}, {0, "baz"}}; -std::ranges::sort(pairs, std::ranges::less<>{}, [](auto const& p) { return p.first; }); +std::ranges::sort(pairs, std::ranges::less{}, [](auto const& p) { return p.first; }); \end{codeblock} sorts the pairs in increasing order of their \tcode{first} members: \begin{codeblock} diff --git a/source/ranges.tex b/source/ranges.tex index d694a9cae8..a0bd343dea 100644 --- a/source/ranges.tex +++ b/source/ranges.tex @@ -53,9 +53,6 @@ template using sentinel_t = decltype(ranges::end(declval())); - template<@\placeholder{forwarding-range}@ R> - using safe_iterator_t = iterator_t; - template concept Range = @\seebelow@; @@ -112,8 +109,15 @@ requires (K == subrange_kind::sized || !SizedSentinel) class subrange; - template<@\placeholder{forwarding-range}@ R> - using safe_subrange_t = subrange>; + // \ref{range.dangling}, dangling iterator handling + struct dangling; + + template + using safe_iterator_t = conditional_t<@\placeholder{forwarding-range}@, iterator_t, dangling>; + + template + using safe_subrange_t = + conditional_t<@\placeholder{forwarding-range}@, subrange>, dangling>; // \ref{range.empty}, empty view template @@ -180,7 +184,7 @@ template requires View && View && - IndirectlyComparable, iterator_t, ranges::equal_to<>> && + IndirectlyComparable, iterator_t, ranges::equal_to> && (ForwardRange || @\placeholder{tiny-range}@) class split_view; @@ -1440,6 +1444,48 @@ \end{codeblock} \end{itemdescr} +\rSec2[range.dangling]{Dangling iterator handling} + +\pnum +The tag type \tcode{dangling} is used together +with the template aliases \tcode{safe_iterator_t} and \tcode{safe_subrange_t} +to indicate that an algorithm +that typically returns an iterator into or subrange of a \tcode{Range} argument +does not return an iterator or subrange +which could potentially reference a range +whose lifetime has ended for a particular rvalue \tcode{Range} argument +which does not model \tcode{\placeholder{forwarding-range}}\iref{range.range}. +\begin{codeblock} +namespace std { + struct dangling { + constexpr dangling() noexcept = default; + template + constexpr dangling(Args&&...) noexcept { } + }; +} +\end{codeblock} + +\pnum +\begin{example} +\begin{codeblock} +vector f(); +auto result1 = ranges::find(f(), 42); // \#1 +static_assert(Same); +auto vec = f(); +auto result2 = ranges::find(vec, 42); // \#2 +static_assert(Same::iterator>); +auto result3 = ranges::find(subrange{vec}, 42); // \#3 +static_assert(Same::iterator>); +\end{codeblock} +The call to \tcode{ranges::find} at \#1 returns \tcode{dangling} +since \tcode{f()} is an rvalue \tcode{vector}; +the \tcode{vector} could potentially be destroyed +before a returned iterator is dereferenced. +However, the calls at \#2 and \#3 both return iterators +since the lvalue \tcode{vec} and specializations of \tcode{subrange} +model \tcode{\placeholder{forwarding-range}}. +\end{example} + \rSec1[range.factories]{Range factories} \pnum @@ -2347,28 +2393,28 @@ \item \tcode{\placeholdernc{decay-copy}(E)} if the decayed type of \tcode{E} models \libconcept{View}. -\item Otherwise, \tcode{\placeholder{ref-view}\{E\}} if that -expression is well-formed, where \tcode{\placeholder{ref-view}} -is the exposition-only \libconcept{View} specified below. +\item Otherwise, \tcode{ref_view\{E\}} if that expression is well-formed. \item Otherwise, \tcode{subrange\{E\}}. \end{itemize} -\rSec3[range.view.ref]{\placeholder{ref-view}} +\rSec3[range.ref.view]{Class template \tcode{ref_view}} +\pnum +\tcode{ref_view} is a \tcode{View} of the elements of some other \tcode{Range}. \begin{codeblock} namespace std::ranges { template requires is_object_v - class @\placeholder{ref-view}@ : public view_interface<@\placeholder{ref-view}@> { + class ref_view : public view_interface> { private: R* r_ = nullptr; // \expos public: - constexpr @\placeholdernc{ref-view}@() noexcept = default; + constexpr ref_view() noexcept = default; - template<@\placeholder{not-same-as}@<@\placeholder{ref-view}@> T> + template<@\placeholder{not-same-as}@ T> requires @\seebelow@ - constexpr @\placeholder{ref-view}@(T&& t); + constexpr ref_view(T&& t); constexpr R& base() const { return *r_; } @@ -2385,22 +2431,22 @@ constexpr auto data() const requires ContiguousRange { return ranges::data(*r_); } - friend constexpr iterator_t begin(@\placeholder{ref-view}@ r) + friend constexpr iterator_t begin(ref_view r) { return r.begin(); } - friend constexpr sentinel_t end(@\placeholder{ref-view}@ r) + friend constexpr sentinel_t end(ref_view r) { return r.end(); } }; template - @\placeholder{ref-view}@(R&) -> @\placeholder{ref-view}@; + ref_view(R&) -> ref_view; } \end{codeblock} -\indexlibrary{\idxcode{\placeholder{ref-view}}!\idxcode{\placeholder{ref-view}}}% +\indexlibrary{\idxcode{ref_view}}% \begin{itemdecl} -template<@\placeholder{not-same-as}@<@\placeholder{ref-view}@> T> +template<@\placeholder{not-same-as}@ T> requires @\seebelow@ -constexpr @\placeholder{ref-view}@(T&& t); +constexpr ref_view(T&& t); \end{itemdecl} \begin{itemdescr} @@ -4308,7 +4354,7 @@ template requires View && View && - IndirectlyComparable, iterator_t, ranges::equal_to<>> && + IndirectlyComparable, iterator_t, ranges::equal_to> && (ForwardRange || @\placeholdernc{tiny-range}@) class split_view : public view_interface> { private: @@ -5113,5 +5159,32 @@ The name \tcode{view::reverse} denotes a range adaptor object\iref{range.adaptor.object}. For some subexpression \tcode{E}, the expression -\tcode{view::reverse(E)} is expression-equivalent to -\tcode{reverse_view\{E\}}. +\tcode{view::reverse(E)} is expression-equivalent to: +\begin{itemize} +\item + If the type of \tcode{E} is + a (possibly cv-qualified) specialization of \tcode{reverse_view}, + equivalent to \tcode{E.base()}. +\item + Otherwise, if the type of \tcode{E} is cv-qualified +\begin{codeblock} +subrange, reverse_iterator, K> +\end{codeblock} + for some iterator type \tcode{I} and + value \tcode{K} of type \tcode{subrange_kind}, + \begin{itemize} + \item + if \tcode{K} is \tcode{subrange_kind::sized}, equivalent to: +\begin{codeblock} +subrange(E.end().base(), E.begin().base(), E.size()) +\end{codeblock} + \item + otherwise, equivalent to: +\begin{codeblock} +subrange(E.end().base(), E.begin().base()) +\end{codeblock} + \end{itemize} + However, in either case \tcode{E} is evaluated only once. +\item + Otherwise, equivalent to \tcode{reverse_view\{E\}}. +\end{itemize} diff --git a/source/utilities.tex b/source/utilities.tex index bcec48b727..212daad266 100644 --- a/source/utilities.tex +++ b/source/utilities.tex @@ -13914,36 +13914,12 @@ namespace ranges { // \ref{range.cmp}, concept-constrained comparisons - template - requires @\seebelow@ struct equal_to; - - template - requires @\seebelow@ struct not_equal_to; - - template - requires @\seebelow@ struct greater; - - template - requires @\seebelow@ struct less; - - template - requires @\seebelow@ struct greater_equal; - - template - requires @\seebelow@ struct less_equal; - - template<> struct equal_to; - template<> struct not_equal_to; - template<> struct greater; - template<> struct less; - template<> struct greater_equal; - template<> struct less_equal; } } \end{codeblock} @@ -14814,97 +14790,7 @@ \indexlibrary{\idxcode{equal_to}}% \begin{itemdecl} -template - requires EqualityComparable || Same || @\placeholdernc{BUILTIN_PTR_CMP}@(const T&, ==, const T&) struct ranges::equal_to { - constexpr bool operator()(const T& x, const T& y) const; -}; -\end{itemdecl} - -\begin{itemdescr} -\pnum -\tcode{operator()} has effects equivalent to: -\tcode{return ranges::equal_to<>\{\}(x, y);} -\end{itemdescr} - -\indexlibrary{\idxcode{not_equal_to}}% -\begin{itemdecl} -template - requires EqualityComparable || Same || @\placeholdernc{BUILTIN_PTR_CMP}@(const T&, ==, const T&) -struct ranges::not_equal_to { - constexpr bool operator()(const T& x, const T& y) const; -}; -\end{itemdecl} - -\begin{itemdescr} -\pnum -\tcode{operator()} has effects equivalent to: -\tcode{return !ranges::equal_to<>\{\}(x, y);} -\end{itemdescr} - -\indexlibrary{\idxcode{greater}}% -\begin{itemdecl} -template - requires StrictTotallyOrdered || Same || @\placeholdernc{BUILTIN_PTR_CMP}@(const T&, <, const T&) -struct ranges::greater { - constexpr bool operator()(const T& x, const T& y) const; -}; -\end{itemdecl} - -\begin{itemdescr} -\pnum -\tcode{operator()} has effects equivalent to: -\tcode{return ranges::less<>\{\}(y, x);} -\end{itemdescr} - -\indexlibrary{\idxcode{less}}% -\begin{itemdecl} -template - requires StrictTotallyOrdered || Same || @\placeholdernc{BUILTIN_PTR_CMP}@(const T&, <, const T&) -struct ranges::less { - constexpr bool operator()(const T& x, const T& y) const; -}; -\end{itemdecl} - -\begin{itemdescr} -\pnum -\tcode{operator()} has effects equivalent to: -\tcode{return ranges::less<>\{\}(x, y);} -\end{itemdescr} - -\indexlibrary{\idxcode{greater_equal}}% -\begin{itemdecl} -template - requires StrictTotallyOrdered || Same || @\placeholdernc{BUILTIN_PTR_CMP}@(const T&, <, const T&) -struct ranges::greater_equal { - constexpr bool operator()(const T& x, const T& y) const; -}; -\end{itemdecl} - -\begin{itemdescr} -\pnum -\tcode{operator()} has effects equivalent to: -\tcode{return !ranges::less<>\{\}(x, y);} -\end{itemdescr} - -\indexlibrary{\idxcode{less_equal}}% -\begin{itemdecl} -template - requires StrictTotallyOrdered || Same || @\placeholdernc{BUILTIN_PTR_CMP}@(const T&, <, const T&) -struct ranges::less_equal { - constexpr bool operator()(const T& x, const T& y) const; -}; -\end{itemdecl} - -\begin{itemdescr} -\pnum -\tcode{operator()} has effects equivalent to: -\tcode{return !ranges::less<>\{\}(y, x);} -\end{itemdescr} - -\indexlibrary{\idxcode{equal_to<>}}% -\begin{itemdecl} -template<> struct ranges::equal_to { template requires EqualityComparableWith || @\placeholdernc{BUILTIN_PTR_CMP}@(T, ==, U) constexpr bool operator()(T&& t, U&& u) const; @@ -14937,9 +14823,9 @@ \end{itemize} \end{itemdescr} -\indexlibrary{\idxcode{not_equal_to<>}}% +\indexlibrary{\idxcode{not_equal_to}}% \begin{itemdecl} -template<> struct ranges::not_equal_to { +struct ranges::not_equal_to { template requires EqualityComparableWith || @\placeholdernc{BUILTIN_PTR_CMP}@(T, ==, U) constexpr bool operator()(T&& t, U&& u) const; @@ -14952,13 +14838,13 @@ \pnum \tcode{operator()} has effects equivalent to: \begin{codeblock} -return !ranges::equal_to<>{}(std::forward(t), std::forward(u)); +return !ranges::equal_to{}(std::forward(t), std::forward(u)); \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{greater<>}}% +\indexlibrary{\idxcode{greater}}% \begin{itemdecl} -template<> struct ranges::greater { +struct ranges::greater { template requires StrictTotallyOrderedWith || @\placeholdernc{BUILTIN_PTR_CMP}@(U, <, T) constexpr bool operator()(T&& t, U&& u) const; @@ -14971,13 +14857,13 @@ \pnum \tcode{operator()} has effects equivalent to: \begin{codeblock} -return ranges::less<>{}(std::forward(u), std::forward(t)); +return ranges::less{}(std::forward(u), std::forward(t)); \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{less<>}}% +\indexlibrary{\idxcode{less}}% \begin{itemdecl} -template<> struct ranges::less { +struct ranges::less { template requires StrictTotallyOrderedWith || @\placeholdernc{BUILTIN_PTR_CMP}@(T, <, U) constexpr bool operator()(T&& t, U&& u) const; @@ -14995,9 +14881,9 @@ equality-preserving\iref{concepts.equality}. For any expressions \tcode{ET} and \tcode{EU} such that \tcode{decltype((ET))} is \tcode{T} and \tcode{decltype((EU))} is \tcode{U}, exactly one of -\tcode{ranges::less<>\{\}(ET, EU)}, -\tcode{ranges::less<>\{\}(EU, ET)}, or -\tcode{ranges::equal_to<>\{\}(ET, EU)} +\tcode{ranges::less\{\}(ET, EU)}, +\tcode{ranges::less\{\}(EU, ET)}, or +\tcode{ranges::equal_to\{\}(ET, EU)} shall be \tcode{true}. \pnum @@ -15010,16 +14896,15 @@ the implementation-defined strict total order over pointers of type \tcode{P} and otherwise \tcode{false}. - \item Otherwise, equivalent to: \tcode{return std::forward(t) < std::forward(u);} \end{itemize} \end{itemdescr} -\indexlibrary{\idxcode{greater_equal<>}}% +\indexlibrary{\idxcode{greater_equal}}% \begin{itemdecl} -template<> struct ranges::greater_equal { +struct ranges::greater_equal { template requires StrictTotallyOrderedWith || @\placeholdernc{BUILTIN_PTR_CMP}@(T, <, U) constexpr bool operator()(T&& t, U&& u) const; @@ -15032,13 +14917,13 @@ \pnum \tcode{operator()} has effects equivalent to: \begin{codeblock} -return !ranges::less<>{}(std::forward(t), std::forward(u)); +return !ranges::less{}(std::forward(t), std::forward(u)); \end{codeblock} \end{itemdescr} -\indexlibrary{\idxcode{less_equal<>}}% +\indexlibrary{\idxcode{less_equal}}% \begin{itemdecl} -template<> struct ranges::less_equal { +struct ranges::less_equal { template requires StrictTotallyOrderedWith || @\placeholdernc{BUILTIN_PTR_CMP}@(U, <, T) constexpr bool operator()(T&& t, U&& u) const; @@ -15051,7 +14936,7 @@ \pnum \tcode{operator()} has effects equivalent to: \begin{codeblock} -return !ranges::less<>{}(std::forward(u), std::forward(t)); +return !ranges::less{}(std::forward(u), std::forward(t)); \end{codeblock} \end{itemdescr} From 0b06fcd5f92bc0439a868471a5fdfdba8a181941 Mon Sep 17 00:00:00 2001 From: Jens Maurer Date: Fri, 8 Mar 2019 22:12:14 +0100 Subject: [PATCH 2/2] [ranges.syn] Add ref_view to header synopsis. --- source/ranges.tex | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/source/ranges.tex b/source/ranges.tex index a0bd343dea..16cbefefd5 100644 --- a/source/ranges.tex +++ b/source/ranges.tex @@ -149,6 +149,10 @@ template using all_view = decltype(view::all(declval())); + template + requires is_object_v + class ref_view; + // \ref{range.filter}, filter view template> Pred> requires View && is_object_v