diff --git a/source/algorithms.tex b/source/algorithms.tex index 950f542ffa..b6175e94fb 100644 --- a/source/algorithms.tex +++ b/source/algorithms.tex @@ -691,7 +691,7 @@ for_each(I first, S last, Fun f, Proj proj = {}); template, Proj>> Fun> - constexpr for_each_result, Fun> + constexpr for_each_result, Fun> for_each(R&& r, Fun f, Proj proj = {}); } @@ -731,21 +731,21 @@ template requires indirect_binary_predicate, Proj>, const T*> - constexpr safe_iterator_t + constexpr borrowed_iterator_t find(R&& r, const T& value, Proj proj = {}); template S, class Proj = identity, indirect_unary_predicate> Pred> constexpr I find_if(I first, S last, Pred pred, Proj proj = {}); template, Proj>> Pred> - constexpr safe_iterator_t + constexpr borrowed_iterator_t find_if(R&& r, Pred pred, Proj proj = {}); template S, class Proj = identity, indirect_unary_predicate> Pred> constexpr I find_if_not(I first, S last, Pred pred, Proj proj = {}); template, Proj>> Pred> - constexpr safe_iterator_t + constexpr borrowed_iterator_t find_if_not(R&& r, Pred pred, Proj proj = {}); } @@ -782,7 +782,7 @@ template requires indirectly_comparable, iterator_t, Pred, Proj1, Proj2> - constexpr safe_subrange_t + constexpr borrowed_subrange_t find_end(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); } @@ -820,7 +820,7 @@ template requires indirectly_comparable, iterator_t, Pred, Proj1, Proj2> - constexpr safe_iterator_t + constexpr borrowed_iterator_t find_first_of(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); @@ -853,7 +853,7 @@ template, Proj>, projected, Proj>> Pred = ranges::equal_to> - constexpr safe_iterator_t + constexpr borrowed_iterator_t adjacent_find(R&& r, Pred pred = {}, Proj proj = {}); } @@ -963,7 +963,7 @@ template requires indirectly_comparable, iterator_t, Pred, Proj1, Proj2> - constexpr mismatch_result, safe_iterator_t> + constexpr mismatch_result, borrowed_iterator_t> mismatch(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); } @@ -1082,7 +1082,7 @@ template requires indirectly_comparable, iterator_t, Pred, Proj1, Proj2> - constexpr safe_subrange_t + constexpr borrowed_subrange_t search(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); } @@ -1119,7 +1119,7 @@ template requires indirectly_comparable, const T*, Pred, Proj> - constexpr safe_subrange_t + constexpr borrowed_subrange_t search_n(R&& r, range_difference_t count, const T& value, Pred pred = {}, Proj proj = {}); } @@ -1163,7 +1163,7 @@ copy(I first, S last, O result); template requires indirectly_copyable, O> - constexpr copy_result, O> + constexpr copy_result, O> copy(R&& r, O result); } @@ -1207,7 +1207,7 @@ template, Proj>> Pred> requires indirectly_copyable, O> - constexpr copy_if_result, O> + constexpr copy_if_result, O> copy_if(R&& r, O result, Pred pred, Proj proj = {}); } @@ -1226,7 +1226,7 @@ copy_backward(I1 first, S1 last, I2 result); template requires indirectly_copyable, I> - constexpr copy_backward_result, I> + constexpr copy_backward_result, I> copy_backward(R&& r, I result); } @@ -1250,7 +1250,7 @@ move(I first, S last, O result); template requires indirectly_movable, O> - constexpr move_result, O> + constexpr move_result, O> move(R&& r, O result); } @@ -1269,7 +1269,7 @@ move_backward(I1 first, S1 last, I2 result); template requires indirectly_movable, I> - constexpr move_backward_result, I> + constexpr move_backward_result, I> move_backward(R&& r, I result); } @@ -1292,7 +1292,7 @@ swap_ranges(I1 first1, S1 last1, I2 first2, S2 last2); template requires indirectly_swappable, iterator_t> - constexpr swap_ranges_result, safe_iterator_t> + constexpr swap_ranges_result, borrowed_iterator_t> swap_ranges(R1&& r1, R2&& r2); } @@ -1336,7 +1336,7 @@ template requires writable, Proj>>> - constexpr unary_transform_result, O> + constexpr unary_transform_result, O> transform(R&& r, O result, F op, Proj proj = {}); template @@ -1372,7 +1372,7 @@ copy_constructible F, class Proj1 = identity, class Proj2 = identity> requires writable, Proj1>, projected, Proj2>>> - constexpr binary_transform_result, safe_iterator_t, O> + constexpr binary_transform_result, borrowed_iterator_t, O> transform(R1&& r1, R2&& r2, O result, F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); } @@ -1403,7 +1403,7 @@ requires writable, const T2&> && indirect_binary_predicate, Proj>, const T1*> - constexpr safe_iterator_t + constexpr borrowed_iterator_t replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {}); template S, class T, class Proj = identity, indirect_unary_predicate> Pred> @@ -1412,7 +1412,7 @@ template, Proj>> Pred> requires writable, const T&> - constexpr safe_iterator_t + constexpr borrowed_iterator_t replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {}); } @@ -1452,7 +1452,7 @@ requires indirectly_copyable, O> && indirect_binary_predicate, Proj>, const T1*> - constexpr replace_copy_result, O> + constexpr replace_copy_result, O> replace_copy(R&& r, O result, const T1& old_value, const T2& new_value, Proj proj = {}); @@ -1468,7 +1468,7 @@ template O, class Proj = identity, indirect_unary_predicate, Proj>> Pred> requires indirectly_copyable, O> - constexpr replace_copy_if_result, O> + constexpr replace_copy_if_result, O> replace_copy_if(R&& r, O result, Pred pred, const T& new_value, Proj proj = {}); } @@ -1490,7 +1490,7 @@ template O, sentinel_for S> constexpr O fill(O first, S last, const T& value); template R> - constexpr safe_iterator_t fill(R&& r, const T& value); + constexpr borrowed_iterator_t fill(R&& r, const T& value); template O> constexpr O fill_n(O first, iter_difference_t n, const T& value); } @@ -1515,7 +1515,7 @@ constexpr O generate(O first, S last, F gen); template requires invocable && output_range> - constexpr safe_iterator_t generate(R&& r, F gen); + constexpr borrowed_iterator_t generate(R&& r, F gen); template requires invocable && writable> constexpr O generate_n(O first, iter_difference_t n, F gen); @@ -1545,7 +1545,7 @@ requires permutable> && indirect_binary_predicate, Proj>, const T*> - constexpr safe_subrange_t + constexpr borrowed_subrange_t remove(R&& r, const T& value, Proj proj = {}); template S, class Proj = identity, indirect_unary_predicate> Pred> @@ -1553,7 +1553,7 @@ template, Proj>> Pred> requires permutable> - constexpr safe_subrange_t + constexpr borrowed_subrange_t remove_if(R&& r, Pred pred, Proj proj = {}); } @@ -1592,7 +1592,7 @@ requires indirectly_copyable, O> && indirect_binary_predicate, Proj>, const T*> - constexpr remove_copy_result, O> + constexpr remove_copy_result, O> remove_copy(R&& r, O result, const T& value, Proj proj = {}); template @@ -1606,7 +1606,7 @@ template, Proj>> Pred> requires indirectly_copyable, O> - constexpr remove_copy_if_result, O> + constexpr remove_copy_if_result, O> remove_copy_if(R&& r, O result, Pred pred, Proj proj = {}); } @@ -1631,7 +1631,7 @@ template, Proj>> C = ranges::equal_to> requires permutable> - constexpr safe_subrange_t + constexpr borrowed_subrange_t unique(R&& r, C comp = {}, Proj proj = {}); } @@ -1673,7 +1673,7 @@ (forward_iterator> || (input_iterator && same_as, iter_value_t>) || indirectly_copyable_storable, O>) - constexpr unique_copy_result, O> + constexpr unique_copy_result, O> unique_copy(R&& r, O result, C comp = {}, Proj proj = {}); } @@ -1690,7 +1690,7 @@ constexpr I reverse(I first, S last); template requires permutable> - constexpr safe_iterator_t reverse(R&& r); + constexpr borrowed_iterator_t reverse(R&& r); } template @@ -1713,7 +1713,7 @@ reverse_copy(I first, S last, O result); template requires indirectly_copyable, O> - constexpr reverse_copy_result, O> + constexpr reverse_copy_result, O> reverse_copy(R&& r, O result); } @@ -1733,7 +1733,7 @@ constexpr subrange rotate(I first, I middle, S last); template requires permutable> - constexpr safe_subrange_t rotate(R&& r, iterator_t middle); + constexpr borrowed_subrange_t rotate(R&& r, iterator_t middle); } template @@ -1756,7 +1756,7 @@ rotate_copy(I first, I middle, S last, O result); template requires indirectly_copyable, O> - constexpr rotate_copy_result, O> + constexpr rotate_copy_result, O> rotate_copy(R&& r, iterator_t middle, O result); } @@ -1781,7 +1781,7 @@ template requires permutable> && uniform_random_bit_generator> - safe_iterator_t shuffle(R&& r, Gen&& g); + borrowed_iterator_t shuffle(R&& r, Gen&& g); } // \ref{alg.shift}, shift @@ -1827,7 +1827,7 @@ sort(I first, S last, Comp comp = {}, Proj proj = {}); template requires sortable, Comp, Proj> - constexpr safe_iterator_t + constexpr borrowed_iterator_t sort(R&& r, Comp comp = {}, Proj proj = {}); } @@ -1851,7 +1851,7 @@ I stable_sort(I first, S last, Comp comp = {}, Proj proj = {}); template requires sortable, Comp, Proj> - safe_iterator_t + borrowed_iterator_t stable_sort(R&& r, Comp comp = {}, Proj proj = {}); } @@ -1882,7 +1882,7 @@ partial_sort(I first, I middle, S last, Comp comp = {}, Proj proj = {}); template requires sortable, Comp, Proj> - constexpr safe_iterator_t + constexpr borrowed_iterator_t partial_sort(R&& r, iterator_t middle, Comp comp = {}, Proj proj = {}); } @@ -1930,7 +1930,7 @@ sortable, Comp, Proj2> && indirect_strict_weak_order, Proj1>, projected, Proj2>> - constexpr partial_sort_copy_result, safe_iterator_t> + constexpr partial_sort_copy_result, borrowed_iterator_t> partial_sort_copy(R1&& r, R2&& result_r, Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); } @@ -1980,7 +1980,7 @@ constexpr I is_sorted_until(I first, S last, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = ranges::less> - constexpr safe_iterator_t + constexpr borrowed_iterator_t is_sorted_until(R&& r, Comp comp = {}, Proj proj = {}); } @@ -2008,7 +2008,7 @@ nth_element(I first, I nth, S last, Comp comp = {}, Proj proj = {}); template requires sortable, Comp, Proj> - constexpr safe_iterator_t + constexpr borrowed_iterator_t nth_element(R&& r, iterator_t nth, Comp comp = {}, Proj proj = {}); } @@ -2030,7 +2030,7 @@ template, Proj>> Comp = ranges::less> - constexpr safe_iterator_t + constexpr borrowed_iterator_t lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); } @@ -2050,7 +2050,7 @@ template, Proj>> Comp = ranges::less> - constexpr safe_iterator_t + constexpr borrowed_iterator_t upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); } @@ -2071,7 +2071,7 @@ template, Proj>> Comp = ranges::less> - constexpr safe_subrange_t + constexpr borrowed_subrange_t equal_range(R&& r, const T& value, Comp comp = {}, Proj proj = {}); } @@ -2130,7 +2130,7 @@ template, Proj>> Pred> requires permutable> - constexpr safe_subrange_t + constexpr borrowed_subrange_t partition(R&& r, Pred pred, Proj proj = {}); } @@ -2152,7 +2152,7 @@ template, Proj>> Pred> requires permutable> - safe_subrange_t stable_partition(R&& r, Pred pred, Proj proj = {}); + borrowed_subrange_t stable_partition(R&& r, Pred pred, Proj proj = {}); } template, Proj>> Pred> requires indirectly_copyable, O1> && indirectly_copyable, O2> - constexpr partition_copy_result, O1, O2> + constexpr partition_copy_result, O1, O2> partition_copy(R&& r, O1 out_true, O2 out_false, Pred pred, Proj proj = {}); } @@ -2218,7 +2218,7 @@ constexpr I partition_point(I first, S last, Pred pred, Proj proj = {}); template, Proj>> Pred> - constexpr safe_iterator_t + constexpr borrowed_iterator_t partition_point(R&& r, Pred pred, Proj proj = {}); } @@ -2263,7 +2263,7 @@ template requires mergeable, iterator_t, O, Comp, Proj1, Proj2> - constexpr merge_result, safe_iterator_t, O> + constexpr merge_result, borrowed_iterator_t, O> merge(R1&& r1, R2&& r2, O result, Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); } @@ -2294,7 +2294,7 @@ I inplace_merge(I first, I middle, S last, Comp comp = {}, Proj proj = {}); template requires sortable, Comp, Proj> - safe_iterator_t + borrowed_iterator_t inplace_merge(R&& r, iterator_t middle, Comp comp = {}, Proj proj = {}); } @@ -2372,7 +2372,7 @@ template requires mergeable, iterator_t, O, Comp, Proj1, Proj2> - constexpr set_union_result, safe_iterator_t, O> + constexpr set_union_result, borrowed_iterator_t, O> set_union(R1&& r1, R2&& r2, O result, Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); } @@ -2416,7 +2416,7 @@ template requires mergeable, iterator_t, O, Comp, Proj1, Proj2> - constexpr set_intersection_result, safe_iterator_t, O> + constexpr set_intersection_result, borrowed_iterator_t, O> set_intersection(R1&& r1, R2&& r2, O result, Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); } @@ -2460,7 +2460,7 @@ template requires mergeable, iterator_t, O, Comp, Proj1, Proj2> - constexpr set_difference_result, O> + constexpr set_difference_result, O> set_difference(R1&& r1, R2&& r2, O result, Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); } @@ -2505,7 +2505,8 @@ template requires mergeable, iterator_t, O, Comp, Proj1, Proj2> - constexpr set_symmetric_difference_result, safe_iterator_t, O> + constexpr set_symmetric_difference_result, + borrowed_iterator_t, O> set_symmetric_difference(R1&& r1, R2&& r2, O result, Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); } @@ -2525,7 +2526,7 @@ push_heap(I first, S last, Comp comp = {}, Proj proj = {}); template requires sortable, Comp, Proj> - constexpr safe_iterator_t + constexpr borrowed_iterator_t push_heap(R&& r, Comp comp = {}, Proj proj = {}); } @@ -2543,7 +2544,7 @@ pop_heap(I first, S last, Comp comp = {}, Proj proj = {}); template requires sortable, Comp, Proj> - constexpr safe_iterator_t + constexpr borrowed_iterator_t pop_heap(R&& r, Comp comp = {}, Proj proj = {}); } @@ -2561,7 +2562,7 @@ make_heap(I first, S last, Comp comp = {}, Proj proj = {}); template requires sortable, Comp, Proj> - constexpr safe_iterator_t + constexpr borrowed_iterator_t make_heap(R&& r, Comp comp = {}, Proj proj = {}); } @@ -2579,7 +2580,7 @@ sort_heap(I first, S last, Comp comp = {}, Proj proj = {}); template requires sortable, Comp, Proj> - constexpr safe_iterator_t + constexpr borrowed_iterator_t sort_heap(R&& r, Comp comp = {}, Proj proj = {}); } @@ -2628,7 +2629,7 @@ constexpr I is_heap_until(I first, S last, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = ranges::less> - constexpr safe_iterator_t + constexpr borrowed_iterator_t is_heap_until(R&& r, Comp comp = {}, Proj proj = {}); } @@ -2738,7 +2739,7 @@ constexpr I min_element(I first, S last, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = ranges::less> - constexpr safe_iterator_t + constexpr borrowed_iterator_t min_element(R&& r, Comp comp = {}, Proj proj = {}); } @@ -2761,7 +2762,7 @@ constexpr I max_element(I first, S last, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = ranges::less> - constexpr safe_iterator_t + constexpr borrowed_iterator_t max_element(R&& r, Comp comp = {}, Proj proj = {}); } @@ -2790,7 +2791,7 @@ minmax_element(I first, S last, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = ranges::less> - constexpr minmax_element_result> + constexpr minmax_element_result> minmax_element(R&& r, Comp comp = {}, Proj proj = {}); } @@ -2875,7 +2876,7 @@ template requires sortable, Comp, Proj> - constexpr next_permutation_result> + constexpr next_permutation_result> next_permutation(R&& r, Comp comp = {}, Proj proj = {}); } @@ -2898,7 +2899,7 @@ template requires sortable, Comp, Proj> - constexpr prev_permutation_result> + constexpr prev_permutation_result> prev_permutation(R&& r, Comp comp = {}, Proj proj = {}); } } @@ -3115,7 +3116,7 @@ ranges::for_each(I first, S last, Fun f, Proj proj = {}); template, Proj>> Fun> - constexpr ranges::for_each_result, Fun> + constexpr ranges::for_each_result, Fun> ranges::for_each(R&& r, Fun f, Proj proj = {}); \end{itemdecl} @@ -3266,21 +3267,21 @@ constexpr I ranges::find(I first, S last, const T& value, Proj proj = {}); template requires indirect_binary_predicate, Proj>, const T*> - constexpr safe_iterator_t + constexpr borrowed_iterator_t ranges::find(R&& r, const T& value, Proj proj = {}); template S, class Proj = identity, indirect_unary_predicate> Pred> constexpr I ranges::find_if(I first, S last, Pred pred, Proj proj = {}); template, Proj>> Pred> - constexpr safe_iterator_t + constexpr borrowed_iterator_t ranges::find_if(R&& r, Pred pred, Proj proj = {}); template S, class Proj = identity, indirect_unary_predicate> Pred> constexpr I ranges::find_if_not(I first, S last, Pred pred, Proj proj = {}); template, Proj>> Pred> - constexpr safe_iterator_t + constexpr borrowed_iterator_t ranges::find_if_not(R&& r, Pred pred, Proj proj = {}); \end{itemdecl} @@ -3345,7 +3346,7 @@ template requires indirectly_comparable, iterator_t, Pred, Proj1, Proj2> - constexpr safe_subrange_t + constexpr borrowed_subrange_t ranges::find_end(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); \end{itemdecl} @@ -3430,7 +3431,7 @@ template requires indirectly_comparable, iterator_t, Pred, Proj1, Proj2> - constexpr safe_iterator_t + constexpr borrowed_iterator_t ranges::find_first_of(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); @@ -3493,7 +3494,7 @@ template, Proj>, projected, Proj>> Pred = ranges::equal_to> - constexpr safe_iterator_t ranges::adjacent_find(R&& r, Pred pred = {}, Proj proj = {}); + constexpr borrowed_iterator_t ranges::adjacent_find(R&& r, Pred pred = {}, Proj proj = {}); \end{itemdecl} \begin{itemdescr} @@ -3651,7 +3652,7 @@ template requires indirectly_comparable, iterator_t, Pred, Proj1, Proj2> - constexpr ranges::mismatch_result, safe_iterator_t> + constexpr ranges::mismatch_result, borrowed_iterator_t> ranges::mismatch(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); \end{itemdecl} @@ -3966,7 +3967,7 @@ template requires indirectly_comparable, iterator_t, Pred, Proj1, Proj2> - constexpr safe_subrange_t + constexpr borrowed_subrange_t ranges::search(R1&& r1, R2&& r2, Pred pred = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); \end{itemdecl} @@ -4054,7 +4055,7 @@ template requires indirectly_comparable, const T*, Pred, Proj> - constexpr safe_subrange_t + constexpr borrowed_subrange_t ranges::search_n(R&& r, range_difference_t count, const T& value, Pred pred = {}, Proj proj = {}); \end{itemdecl} @@ -4107,7 +4108,7 @@ constexpr ranges::copy_result ranges::copy(I first, S last, O result); template requires indirectly_copyable, O> - constexpr ranges::copy_result, O> ranges::copy(R&& r, O result); + constexpr ranges::copy_result, O> ranges::copy(R&& r, O result); \end{itemdecl} \begin{itemdescr} @@ -4235,7 +4236,7 @@ template, Proj>> Pred> requires indirectly_copyable, O> - constexpr ranges::copy_if_result, O> + constexpr ranges::copy_if_result, O> ranges::copy_if(R&& r, O result, Pred pred, Proj proj = {}); \end{itemdecl} @@ -4305,7 +4306,7 @@ ranges::copy_backward(I1 first, S1 last, I2 result); template requires indirectly_copyable, I> - constexpr ranges::copy_backward_result, I> + constexpr ranges::copy_backward_result, I> ranges::copy_backward(R&& r, I result); \end{itemdecl} @@ -4357,7 +4358,7 @@ ranges::move(I first, S last, O result); template requires indirectly_movable, O> - constexpr ranges::move_result, O> + constexpr ranges::move_result, O> ranges::move(R&& r, O result); \end{itemdecl} @@ -4447,7 +4448,7 @@ ranges::move_backward(I1 first, S1 last, I2 result); template requires indirectly_movable, I> - constexpr ranges::move_backward_result, I> + constexpr ranges::move_backward_result, I> ranges::move_backward(R&& r, I result); \end{itemdecl} @@ -4514,7 +4515,7 @@ ranges::swap_ranges(I1 first1, S1 last1, I2 first2, S2 last2); template requires indirectly_swappable, iterator_t> - constexpr ranges::swap_ranges_result, safe_iterator_t> + constexpr ranges::swap_ranges_result, borrowed_iterator_t> ranges::swap_ranges(R1&& r1, R2&& r2); \end{itemdecl} @@ -4619,7 +4620,7 @@ template requires writable, Proj>>> - constexpr ranges::unary_transform_result, O> + constexpr ranges::unary_transform_result, O> ranges::transform(R&& r, O result, F op, Proj proj = {}); template S1, input_iterator I2, sentinel_for S2, weakly_incrementable O, copy_constructible F, class Proj1 = identity, @@ -4633,7 +4634,7 @@ copy_constructible F, class Proj1 = identity, class Proj2 = identity> requires writable, Proj1>, projected, Proj2>>> - constexpr ranges::binary_transform_result, safe_iterator_t, O> + constexpr ranges::binary_transform_result, borrowed_iterator_t, O> ranges::transform(R1&& r1, R2&& r2, O result, F binary_op, Proj1 proj1 = {}, Proj2 proj2 = {}); \end{itemdecl} @@ -4739,7 +4740,7 @@ template requires writable, const T2&> && indirect_binary_predicate, Proj>, const T1*> - constexpr safe_iterator_t + constexpr borrowed_iterator_t ranges::replace(R&& r, const T1& old_value, const T2& new_value, Proj proj = {}); template S, class T, class Proj = identity, indirect_unary_predicate> Pred> @@ -4748,7 +4749,7 @@ template, Proj>> Pred> requires writable, const T&> - constexpr safe_iterator_t + constexpr borrowed_iterator_t ranges::replace_if(R&& r, Pred pred, const T& new_value, Proj proj = {}); \end{itemdecl} @@ -4822,7 +4823,7 @@ class Proj = identity> requires indirectly_copyable, O> && indirect_binary_predicate, Proj>, const T1*> - constexpr ranges::replace_copy_result, O> + constexpr ranges::replace_copy_result, O> ranges::replace_copy(R&& r, O result, const T1& old_value, const T2& new_value, Proj proj = {}); @@ -4835,7 +4836,7 @@ template O, class Proj = identity, indirect_unary_predicate, Proj>> Pred> requires indirectly_copyable, O> - constexpr ranges::replace_copy_if_result, O> + constexpr ranges::replace_copy_if_result, O> ranges::replace_copy_if(R&& r, O result, Pred pred, const T& new_value, Proj proj = {}); \end{itemdecl} @@ -4910,7 +4911,7 @@ template O, sentinel_for S> constexpr O ranges::fill(O first, S last, const T& value); template R> - constexpr safe_iterator_t ranges::fill(R&& r, const T& value); + constexpr borrowed_iterator_t ranges::fill(R&& r, const T& value); template O> constexpr O ranges::fill_n(O first, iter_difference_t n, const T& value); \end{itemdecl} @@ -4965,7 +4966,7 @@ constexpr O ranges::generate(O first, S last, F gen); template requires invocable && output_range> - constexpr safe_iterator_t ranges::generate(R&& r, F gen); + constexpr borrowed_iterator_t ranges::generate(R&& r, F gen); template requires invocable && writable> constexpr O ranges::generate_n(O first, iter_difference_t n, F gen); @@ -5022,7 +5023,7 @@ template requires permutable> && indirect_binary_predicate, Proj>, const T*> - constexpr safe_subrange_t + constexpr borrowed_subrange_t ranges::remove(R&& r, const T& value, Proj proj = {}); template S, class Proj = identity, indirect_unary_predicate> Pred> @@ -5030,7 +5031,7 @@ template, Proj>> Pred> requires permutable> - constexpr safe_subrange_t + constexpr borrowed_subrange_t ranges::remove_if(R&& r, Pred pred, Proj proj = {}); \end{itemdecl} @@ -5116,7 +5117,7 @@ template requires indirectly_copyable, O> && indirect_binary_predicate, Proj>, const T*> - constexpr ranges::remove_copy_result, O> + constexpr ranges::remove_copy_result, O> ranges::remove_copy(R&& r, O result, const T& value, Proj proj = {}); template S, weakly_incrementable O, class Proj = identity, indirect_unary_predicate> Pred> @@ -5126,7 +5127,7 @@ template, Proj>> Pred> requires indirectly_copyable, O> - constexpr ranges::remove_copy_if_result, O> + constexpr ranges::remove_copy_if_result, O> ranges::remove_copy_if(R&& r, O result, Pred pred, Proj proj = {}); \end{itemdecl} @@ -5205,7 +5206,7 @@ template, Proj>> C = ranges::equal_to> requires permutable> - constexpr safe_subrange_t + constexpr borrowed_subrange_t ranges::unique(R&& r, C comp = {}, Proj proj = {}); \end{itemdecl} @@ -5291,7 +5292,7 @@ (forward_iterator> || (input_iterator && same_as, iter_value_t>) || indirectly_copyable_storable, O>) - constexpr ranges::unique_copy_result, O> + constexpr ranges::unique_copy_result, O> ranges::unique_copy(R&& r, O result, C comp = {}, Proj proj = {}); \end{itemdecl} @@ -5383,7 +5384,7 @@ constexpr I ranges::reverse(I first, S last); template requires permutable> - constexpr safe_iterator_t ranges::reverse(R&& r); + constexpr borrowed_iterator_t ranges::reverse(R&& r); \end{itemdecl} \begin{itemdescr} @@ -5427,7 +5428,7 @@ ranges::reverse_copy(I first, S last, O result); template requires indirectly_copyable, O> - constexpr ranges::reverse_copy_result, O> + constexpr ranges::reverse_copy_result, O> ranges::reverse_copy(R&& r, O result); \end{itemdecl} @@ -5516,7 +5517,7 @@ \begin{itemdecl} template requires permutable> - constexpr safe_subrange_t ranges::rotate(R&& r, iterator_t middle); + constexpr borrowed_subrange_t ranges::rotate(R&& r, iterator_t middle); \end{itemdecl} \begin{itemdescr} @@ -5578,7 +5579,7 @@ \begin{itemdecl} template requires indirectly_copyable, O> - constexpr ranges::rotate_copy_result, O> + constexpr ranges::rotate_copy_result, O> ranges::rotate_copy(R&& r, iterator_t middle, O result); \end{itemdecl} @@ -5676,7 +5677,7 @@ template requires permutable> && uniform_random_bit_generator> - safe_iterator_t ranges::shuffle(R&& r, Gen&& g); + borrowed_iterator_t ranges::shuffle(R&& r, Gen&& g); \end{itemdecl} \begin{itemdescr} @@ -5907,7 +5908,7 @@ ranges::sort(I first, S last, Comp comp = {}, Proj proj = {}); template requires sortable, Comp, Proj> - constexpr safe_iterator_t + constexpr borrowed_iterator_t ranges::sort(R&& r, Comp comp = {}, Proj proj = {}); \end{itemdecl} @@ -5965,7 +5966,7 @@ I ranges::stable_sort(I first, S last, Comp comp = {}, Proj proj = {}); template requires sortable, Comp, Proj> - safe_iterator_t + borrowed_iterator_t ranges::stable_sort(R&& r, Comp comp = {}, Proj proj = {}); \end{itemdecl} @@ -6077,7 +6078,7 @@ \begin{itemdecl} template requires sortable, Comp, Proj> - constexpr safe_iterator_t + constexpr borrowed_iterator_t ranges::partial_sort(R&& r, iterator_t middle, Comp comp = {}, Proj proj = {}); \end{itemdecl} @@ -6135,7 +6136,7 @@ sortable, Comp, Proj2> && indirect_strict_weak_order, Proj1>, projected, Proj2>> - constexpr ranges::partial_sort_copy_result, safe_iterator_t> + constexpr ranges::partial_sort_copy_result, borrowed_iterator_t> ranges::partial_sort_copy(R1&& r, R2&& result_r, Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); \end{itemdecl} @@ -6304,7 +6305,7 @@ constexpr I ranges::is_sorted_until(I first, S last, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = ranges::less> - constexpr safe_iterator_t + constexpr borrowed_iterator_t ranges::is_sorted_until(R&& r, Comp comp = {}, Proj proj = {}); \end{itemdecl} @@ -6393,7 +6394,7 @@ \begin{itemdecl} template requires sortable, Comp, Proj> - constexpr safe_iterator_t + constexpr borrowed_iterator_t ranges::nth_element(R&& r, iterator_t nth, Comp comp = {}, Proj proj = {}); \end{itemdecl} @@ -6441,7 +6442,7 @@ template, Proj>> Comp = ranges::less> - constexpr safe_iterator_t + constexpr borrowed_iterator_t ranges::lower_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); \end{itemdecl} @@ -6488,7 +6489,7 @@ template, Proj>> Comp = ranges::less> - constexpr safe_iterator_t + constexpr borrowed_iterator_t ranges::upper_bound(R&& r, const T& value, Comp comp = {}, Proj proj = {}); \end{itemdecl} @@ -6537,7 +6538,7 @@ template, Proj>> Comp = ranges::less> - constexpr safe_subrange_t + constexpr borrowed_subrange_t ranges::equal_range(R&& r, const T& value, Comp comp = {}, Proj proj = {}); \end{itemdecl} @@ -6686,7 +6687,7 @@ template, Proj>> Pred> requires permutable> - constexpr safe_subrange_t + constexpr borrowed_subrange_t ranges::partition(R&& r, Pred pred, Proj proj = {}); \end{itemdecl} @@ -6756,7 +6757,7 @@ template, Proj>> Pred> requires permutable> - safe_subrange_t ranges::stable_partition(R&& r, Pred pred, Proj proj = {}); + borrowed_subrange_t ranges::stable_partition(R&& r, Pred pred, Proj proj = {}); \end{itemdecl} \begin{itemdescr} @@ -6833,7 +6834,7 @@ indirect_unary_predicate, Proj>> Pred> requires indirectly_copyable, O1> && indirectly_copyable, O2> - constexpr ranges::partition_copy_result, O1, O2> + constexpr ranges::partition_copy_result, O1, O2> ranges::partition_copy(R&& r, O1 out_true, O2 out_false, Pred pred, Proj proj = {}); \end{itemdecl} @@ -6893,7 +6894,7 @@ constexpr I ranges::partition_point(I first, S last, Pred pred, Proj proj = {}); template, Proj>> Pred> - constexpr safe_iterator_t + constexpr borrowed_iterator_t ranges::partition_point(R&& r, Pred pred, Proj proj = {}); \end{itemdecl} @@ -6963,7 +6964,7 @@ template requires mergeable, iterator_t, O, Comp, Proj1, Proj2> - constexpr ranges::merge_result, safe_iterator_t, O> + constexpr ranges::merge_result, borrowed_iterator_t, O> ranges::merge(R1&& r1, R2&& r2, O result, Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); \end{itemdecl} @@ -7098,7 +7099,7 @@ \begin{itemdecl} template requires sortable, Comp, Proj> - safe_iterator_t + borrowed_iterator_t ranges::inplace_merge(R&& r, iterator_t middle, Comp comp = {}, Proj proj = {}); \end{itemdecl} @@ -7228,7 +7229,7 @@ template requires mergeable, iterator_t, O, Comp, Proj1, Proj2> - constexpr ranges::set_union_result, safe_iterator_t, O> + constexpr ranges::set_union_result, borrowed_iterator_t, O> ranges::set_union(R1&& r1, R2&& r2, O result, Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); \end{itemdecl} @@ -7323,7 +7324,7 @@ template requires mergeable, iterator_t, O, Comp, Proj1, Proj2> - constexpr ranges::set_intersection_result, safe_iterator_t, O> + constexpr ranges::set_intersection_result, borrowed_iterator_t, O> ranges::set_intersection(R1&& r1, R2&& r2, O result, Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); \end{itemdecl} @@ -7416,7 +7417,7 @@ template requires mergeable, iterator_t, O, Comp, Proj1, Proj2> - constexpr ranges::set_difference_result, O> + constexpr ranges::set_difference_result, O> ranges::set_difference(R1&& r1, R2&& r2, O result, Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); \end{itemdecl} @@ -7511,7 +7512,8 @@ template requires mergeable, iterator_t, O, Comp, Proj1, Proj2> - constexpr ranges::set_symmetric_difference_result, safe_iterator_t, O> + constexpr ranges::set_symmetric_difference_result, + borrowed_iterator_t, O> ranges::set_symmetric_difference(R1&& r1, R2&& r2, O result, Comp comp = {}, Proj1 proj1 = {}, Proj2 proj2 = {}); \end{itemdecl} @@ -7613,7 +7615,7 @@ ranges::push_heap(I first, S last, Comp comp = {}, Proj proj = {}); template requires sortable, Comp, Proj> - constexpr safe_iterator_t + constexpr borrowed_iterator_t ranges::push_heap(R&& r, Comp comp = {}, Proj proj = {}); \end{itemdecl} @@ -7664,7 +7666,7 @@ ranges::pop_heap(I first, S last, Comp comp = {}, Proj proj = {}); template requires sortable, Comp, Proj> - constexpr safe_iterator_t + constexpr borrowed_iterator_t ranges::pop_heap(R&& r, Comp comp = {}, Proj proj = {}); \end{itemdecl} @@ -7722,7 +7724,7 @@ ranges::make_heap(I first, S last, Comp comp = {}, Proj proj = {}); template requires sortable, Comp, Proj> - constexpr safe_iterator_t + constexpr borrowed_iterator_t ranges::make_heap(R&& r, Comp comp = {}, Proj proj = {}); \end{itemdecl} @@ -7771,7 +7773,7 @@ ranges::sort_heap(I first, S last, Comp comp = {}, Proj proj = {}); template requires sortable, Comp, Proj> - constexpr safe_iterator_t + constexpr borrowed_iterator_t ranges::sort_heap(R&& r, Comp comp = {}, Proj proj = {}); \end{itemdecl} @@ -7909,7 +7911,7 @@ constexpr I ranges::is_heap_until(I first, S last, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = ranges::less> - constexpr safe_iterator_t + constexpr borrowed_iterator_t ranges::is_heap_until(R&& r, Comp comp = {}, Proj proj = {}); \end{itemdecl} @@ -8195,7 +8197,7 @@ constexpr I ranges::min_element(I first, S last, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = ranges::less> - constexpr safe_iterator_t + constexpr borrowed_iterator_t ranges::min_element(R&& r, Comp comp = {}, Proj proj = {}); \end{itemdecl} @@ -8242,7 +8244,7 @@ constexpr I ranges::max_element(I first, S last, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = ranges::less> - constexpr safe_iterator_t + constexpr borrowed_iterator_t ranges::max_element(R&& r, Comp comp = {}, Proj proj = {}); \end{itemdecl} @@ -8292,7 +8294,7 @@ ranges::minmax_element(I first, S last, Comp comp = {}, Proj proj = {}); template, Proj>> Comp = ranges::less> - constexpr ranges::minmax_result> + constexpr ranges::minmax_result> ranges::minmax_element(R&& r, Comp comp = {}, Proj proj = {}); \end{itemdecl} @@ -8504,7 +8506,7 @@ template requires sortable, Comp, Proj> - constexpr ranges::next_permutation_result> + constexpr ranges::next_permutation_result> ranges::next_permutation(R&& r, Comp comp = {}, Proj proj = {}); \end{itemdecl} @@ -8563,7 +8565,7 @@ template requires sortable, Comp, Proj> - constexpr ranges::prev_permutation_result> + constexpr ranges::prev_permutation_result> ranges::prev_permutation(R&& r, Comp comp = {}, Proj proj = {}); \end{itemdecl} @@ -9896,7 +9898,11 @@ \begin{itemdescr} \pnum \constraints -\tcode{T} is a complete object type. +\tcode{T} is an object type. + +\pnum +\mandates +\tcode{T} is a complete type. \pnum \expects diff --git a/source/concepts.tex b/source/concepts.tex index 8ec984eb9d..b7cf3bf4ec 100644 --- a/source/concepts.tex +++ b/source/concepts.tex @@ -562,13 +562,14 @@ \item If \tcode{T} and \tcode{U} are the same type, the result of the operation is that \tcode{t1} equals \tcode{u2} and \tcode{u1} equals \tcode{t2}. -\item If \tcode{T} and \tcode{U} are different types that model - \tcode{\libconcept{common_reference_with}}, +\item If \tcode{T} and \tcode{U} are different types and + \tcode{\libconcept{common_reference_with}} + is modeled, the result of the operation is that \tcode{C(t1)} equals \tcode{C(u2)} and \tcode{C(u1)} equals \tcode{C(t2)} - where \tcode{C} is \tcode{common_reference_t}. + where \tcode{C} is \tcode{common_reference_t}. \end{itemize} \pnum @@ -648,7 +649,7 @@ \begin{itemdecl} template concept @\deflibconcept{swappable_with}@ = - common_reference_with&, const remove_reference_t&> && + common_reference_with && requires(T&& t, U&& u) { ranges::swap(std::forward(t), std::forward(t)); ranges::swap(std::forward(u), std::forward(u)); @@ -686,13 +687,14 @@ namespace N { struct A { int m; }; - struct Proxy { A* a; }; - Proxy proxy(A& a) { return Proxy{ &a }; } - - void swap(A& x, Proxy p) { - ranges::swap(x.m, p.a->m); - } - void swap(Proxy p, A& x) { swap(x, p); } // satisfy symmetry requirement + struct Proxy { + A* a; + Proxy(A& a) : a{&a} {} + friend void swap(Proxy x, Proxy y) { + ranges::swap(*x.a, *y.a); + } + }; + Proxy proxy(A& a) { return Proxy{ a }; } } int main() { @@ -805,9 +807,11 @@ \tcode{T} models \libconcept{copy_constructible} only if \begin{itemize} -\item After the definition \tcode{T u = v;}, \tcode{u} is equal to \tcode{v}. +\item After the definition \tcode{T u = v;}, +\tcode{u} is equal to \tcode{v}\iref{concepts.equality} and +\tcode{v} is not modified. -\item \tcode{T(v)} is equal to \tcode{v}. +\item \tcode{T(v)} is equal to \tcode{v} and does not modify \tcode{v}. \end{itemize} \end{itemdescr} diff --git a/source/containers.tex b/source/containers.tex index f19d29aaff..fef526c62a 100644 --- a/source/containers.tex +++ b/source/containers.tex @@ -214,11 +214,9 @@ constant \\ \rowsep \tcode{i <=> j} & - \tcode{strong_ordering} - if \tcode{X::iterator} meets the random access iterator requirements, - otherwise \tcode{strong_equality} & - & - & + \tcode{strong_ordering} & + & + \constraints \tcode{X::iterator} meets the random access iterator requirements. & constant \\ \rowsep \tcode{a == b} & @@ -3121,6 +3119,13 @@ // \ref{array}, class template \tcode{array} template struct array; + template + constexpr bool operator==(const array& x, const array& y); + template + constexpr @\placeholder{synth-three-way-result}@ + operator<=>(const array& x, const array& y); + + // \ref{array.special}, specialized algorithms template constexpr void swap(array& x, array& y) noexcept(noexcept(x.swap(y))); @@ -3319,6 +3324,14 @@ one of these tables and for operations where there is additional semantic information. +\pnum +\tcode{array} is a structural type\iref{temp.param} if +\tcode{T} is a structural type. +Two values \tcode{a1} and \tcode{a2} of type \tcode{array} +are template-argument-equivalent\iref{temp.type} if and only if +each pair of corresponding elements in \tcode{a1} and \tcode{a2} +are template-argument-equivalent. + \pnum The types \tcode{iterator} and \tcode{const_iterator} meet the constexpr iterator requirements\iref{iterator.requirements.general}. @@ -3383,10 +3396,6 @@ constexpr T * data() noexcept; constexpr const T * data() const noexcept; - - friend constexpr bool operator==(const array&, const array&) = default; - friend constexpr @\placeholder{synth-three-way-result}@ - operator<=>(const array&, const array&); }; template @@ -10529,7 +10538,7 @@ inline constexpr bool ranges::enable_view> = Extent == 0 || Extent == dynamic_extent; template - inline constexpr bool ranges::enable_safe_range> = true; + inline constexpr bool ranges::enable_borrowed_range> = true; // \ref{span.objectrep}, views of object representation template @@ -10592,11 +10601,11 @@ template constexpr span(It first, End last); template - constexpr span(element_type (&arr)[N]) noexcept; - template - constexpr span(array& arr) noexcept; - template - constexpr span(const array& arr) noexcept; + constexpr span(type_identity_t (&arr)[N]) noexcept; + template + constexpr span(array& arr) noexcept; + template + constexpr span(const array& arr) noexcept; template constexpr span(R&& r); constexpr span(const span& other) noexcept = default; @@ -10756,14 +10765,14 @@ \pnum \throws -Nothing. +When and what \tcode{last - first} throws. \end{itemdescr} \indexlibraryctor{span}% \begin{itemdecl} -template constexpr span(element_type (&arr)[N]) noexcept; -template constexpr span(array& arr) noexcept; -template constexpr span(const array& arr) noexcept; +template constexpr span(type_identity_t (&arr)[N]) noexcept; +template constexpr span(array& arr) noexcept; +template constexpr span(const array& arr) noexcept; \end{itemdecl} \begin{itemdescr} @@ -10777,10 +10786,13 @@ \pnum \effects Constructs a \tcode{span} that is a view over the supplied array. +\begin{note} +\tcode{type_identity_t} affects class template argument deduction. +\end{note} \pnum \ensures -\tcode{size() == N \&\& data() == data(arr)}. +\tcode{size() == N \&\& data() == data(arr)} is \tcode{true}. \end{itemdescr} \indexlibraryctor{span}% @@ -10796,7 +10808,7 @@ \item \tcode{extent == dynamic_extent} is \tcode{true}. \item \tcode{R} satisfies \tcode{ranges::\libconcept{contiguous_range}} and \tcode{ranges::\libconcept{sized_range}}. -\item Either \tcode{R} satisfies \tcode{ranges::\libconcept{safe_range}} or +\item Either \tcode{R} satisfies \tcode{ranges::\libconcept{borrowed_range}} or \tcode{is_const_v} is \tcode{true}. \item \tcode{remove_cvref_t} is not a specialization of \tcode{span}. \item \tcode{remove_cvref_t} is not a specialization of \tcode{array}. @@ -10815,7 +10827,7 @@ \item \tcode{R} models \tcode{ranges::\libconcept{contiguous_range}} and \tcode{ranges::\libconcept{sized_range}}. \item If \tcode{is_const_v} is \tcode{false}, -\tcode{R} models \tcode{ranges::\libconcept{safe_range}}. +\tcode{R} models \tcode{ranges::\libconcept{borrowed_range}}. \end{itemize} \pnum diff --git a/source/future.tex b/source/future.tex index a37e7db039..ffab6b1cda 100644 --- a/source/future.tex +++ b/source/future.tex @@ -2477,6 +2477,13 @@ For Windows-based operating systems a conversion from UTF-8 to UTF-16 occurs. \end{example} +\begin{note} +The example above is representative of +a historical use of \tcode{filesystem::u8path}. +Passing a \tcode{std::u8string} to \tcode{path}'s constructor is preferred +for an indication of UTF-8 encoding more consistent with +\tcode{path}'s handling of other encodings. +\end{note} \end{itemdescr} \rSec1[depr.atomics]{Deprecated atomic initialization} diff --git a/source/iostreams.tex b/source/iostreams.tex index 131afb7c7b..1099982085 100644 --- a/source/iostreams.tex +++ b/source/iostreams.tex @@ -5548,21 +5548,23 @@ \indexlibrarymember{operator>>}{basic_istream}% \begin{itemdecl} -template - basic_istream& operator>>(basic_istream&& is, T&& x); +template + Istream&& operator>>(Istream&& is, T&& x); \end{itemdecl} \begin{itemdescr} \pnum \constraints -The expression \tcode{is >> std::forward(x)} is well-formed when treated as an unevaluated operand. +The expression \tcode{is >> std::forward(x)} is well-formed +when treated as an unevaluated operand and +\tcode{Istream} is publicly and unambiguously derived from \tcode{ios_base}. \pnum \effects Equivalent to: \begin{codeblock} is >> std::forward(x); -return is; +return std::move(is); \end{codeblock} \end{itemdescr} @@ -6759,14 +6761,16 @@ \indexlibrarymember{operator<<}{basic_ostream}% \begin{itemdecl} -template - basic_ostream& operator<<(basic_ostream&& os, const T& x); +template + Ostream&& operator<<(Ostream&& os, const T& x); \end{itemdecl} \begin{itemdescr} \pnum \constraints -The expression \tcode{os << x} is well-formed when treated as an unevaluated operand. +The expression \tcode{os << x} is well-formed +when treated as an unevaluated operand and +\tcode{Ostream} is publicly and unambiguously derived from \tcode{ios_base}. \pnum \effects @@ -6774,7 +6778,7 @@ \pnum \returns -\tcode{os}. +\tcode{std::move(os)}. \end{itemdescr} @@ -11054,7 +11058,7 @@ basic_osyncstream(basic_osyncstream&&) noexcept; ~basic_osyncstream(); - // \ref{syncstream.osyncstream.assign}, assignment + // assignment basic_osyncstream& operator=(basic_osyncstream&&) noexcept; // \ref{syncstream.osyncstream.members}, member functions @@ -11140,46 +11144,6 @@ \tcode{nullptr == other.get_wrapped()} is \tcode{true}. \end{itemdescr} -\indexlibrarydtor{basic_osyncstream}% -\begin{itemdecl} -~basic_osyncstream(); -\end{itemdecl} - -\begin{itemdescr} -\pnum -\effects -Calls \tcode{emit()}. -If an exception is thrown from \tcode{emit()}, -that exception is caught and ignored. -\end{itemdescr} - -\rSec3[syncstream.osyncstream.assign]{Assignment} - -\indexlibrarymember{operator=}{basic_osyncstream}% -\begin{itemdecl} -basic_osyncstream& operator=(basic_osyncstream&& rhs) noexcept; -\end{itemdecl} - -\begin{itemdescr} -\pnum -\effects -First, calls \tcode{emit()}. -If an exception is thrown from \tcode{emit()}, -that exception is caught and ignored. -Move assigns \tcode{sb} from \tcode{rhs.sb}. -\begin{note} -This disassociates \tcode{rhs} -from its wrapped stream buffer -ensuring destruction of \tcode{rhs} produces no output. -\end{note} - -\pnum -\ensures -\tcode{nullptr == rhs.get_wrapped()} is \tcode{true}. -\tcode{get_wrapped()} returns the value -previously returned by \tcode{rhs.get_wrapped()}. -\end{itemdescr} - \rSec3[syncstream.osyncstream.members]{Member functions} \indexlibrarymember{set_emit_on_sync}{basic_osyncstream}% diff --git a/source/iterators.tex b/source/iterators.tex index d2739af41e..fd6d24d8c6 100644 --- a/source/iterators.tex +++ b/source/iterators.tex @@ -371,7 +371,7 @@ // \ref{iterators.common}, common iterators template S> - requires (!same_as) + requires (!same_as && copyable) class common_iterator; template @@ -1058,9 +1058,13 @@ \begin{itemize} \item \tcode{iter_move(E)}, if \tcode{E} has class or enumeration type and -\tcode{iter_move(E)} is a well-formed expression with overload -resolution performed in a context that does not include a declaration of -\tcode{ranges::iter_move}. +\tcode{iter_move(E)} is a well-formed expression when treated as an unevaluated operand, +with overload resolution performed in a context +that does not include a declaration of \tcode{ranges::iter_move} +but does include the declaration +\begin{codeblock} +void iter_move(); +\end{codeblock} \item Otherwise, if the expression \tcode{*E} is well-formed: \begin{itemize} @@ -1357,13 +1361,17 @@ \end{itemize} \pnum -All integer-class types are explicitly convertible to all integral types and -implicitly and explicitly convertible from all integral types. +Expressions of integer-class type are +explicitly convertible to any integral type. +Expressions of integral type are +both implicitly and explicitly convertible to any integer-class type. +Conversions between integral and integer-class types +do not exit via an exception. \pnum -All integer-class types are contextually convertible to \tcode{bool} -as if by \tcode{bool(a != I(0))}, where \tcode{a} is an -instance of the integral-class type \tcode{I}. +An expression \tcode{E} of integer-class type \tcode{I} is +contextually convertible to \tcode{bool} +as if by \tcode{bool(E != I(0))}. \pnum All integer-class types model @@ -4556,7 +4564,7 @@ \begin{itemdescr} \pnum \returns -\tcode{move_iterator(i)}. +\tcode{move_iterator(std::move(i))}. \end{itemdescr} \rSec3[move.sentinel]{Class template \tcode{move_sentinel}} @@ -4704,7 +4712,7 @@ \begin{codeblock} namespace std { template S> - requires (!same_as) + requires (!same_as && copyable) class common_iterator { public: constexpr common_iterator() = default; @@ -5238,7 +5246,7 @@ \pnum \effects -Initializes \tcode{current} with \tcode{i} and +Initializes \tcode{current} with \tcode{std::move(i)} and \tcode{length} with \tcode{n}. \end{itemdescr} diff --git a/source/lib-intro.tex b/source/lib-intro.tex index c802b2b1fb..1b44eecafd 100644 --- a/source/lib-intro.tex +++ b/source/lib-intro.tex @@ -180,8 +180,11 @@ \definition{comparison function}{defns.comparison} \indexdefn{function!comparison}% -operator function\iref{over.oper} for any of the equality\iref{expr.eq} or -relational\iref{expr.rel} operators +operator function\iref{over.oper} for any of the +equality\iref{expr.eq}, +relational\iref{expr.rel}, or +three-way comparison\iref{expr.spaceship} +operators \definition{component}{defns.component} \indexdefn{component}% diff --git a/source/numerics.tex b/source/numerics.tex index 0bbce4e248..1cd94a8f57 100644 --- a/source/numerics.tex +++ b/source/numerics.tex @@ -2153,6 +2153,7 @@ requires { { G::min() } -> same_as>; { G::max() } -> same_as>; + requires bool_constant<(G::min() < G::max())>::value; }; \end{codeblock} @@ -2160,9 +2161,6 @@ Let \tcode{g} be an object of type \tcode{G}. \tcode{G} models \libconcept{uniform_random_bit_generator} only if \begin{itemize} -\item both \tcode{G::min()} and \tcode{G::max()} are constant - expressions\iref{expr.const}, -\item \tcode{G::min() < G::max()}, \item \tcode{G::min() <= g()}, \item \tcode{g() <= G::max()}, and \item \tcode{g()} has amortized constant complexity. @@ -9565,9 +9563,9 @@ long double fmal(long double x, long double y, long double z); // \ref{c.math.lerp}, linear interpolation - constexpr float lerp(float a, float b, float t); - constexpr double lerp(double a, double b, double t); - constexpr long double lerp(long double a, long double b, long double t); + constexpr float lerp(float a, float b, float t) noexcept; + constexpr double lerp(double a, double b, double t) noexcept; + constexpr long double lerp(long double a, long double b, long double t) noexcept; // \ref{c.math.fpclass}, classification / comparison functions int fpclassify(float x); @@ -9831,9 +9829,9 @@ \indexlibraryglobal{lerp}% \begin{itemdecl} -constexpr float lerp(float a, float b, float t); -constexpr double lerp(double a, double b, double t); -constexpr long double lerp(long double a, long double b, long double t); +constexpr float lerp(float a, float b, float t) noexcept; +constexpr double lerp(double a, double b, double t) noexcept; +constexpr long double lerp(long double a, long double b, long double t) noexcept; \end{itemdecl} \begin{itemdescr} \pnum diff --git a/source/preprocessor.tex b/source/preprocessor.tex index 58ab88192d..5460b86ec5 100644 --- a/source/preprocessor.tex +++ b/source/preprocessor.tex @@ -1732,7 +1732,6 @@ \defnxname{cpp_constexpr_in_decltype} & \tcode{201711L} \\ \rowsep \defnxname{cpp_consteval} & \tcode{201811L} \\ \rowsep \defnxname{cpp_constinit} & \tcode{201907L} \\ \rowsep -\defnxname{cpp_coroutines} & \tcode{201902L} \\ \rowsep \defnxname{cpp_decltype} & \tcode{200707L} \\ \rowsep \defnxname{cpp_decltype_auto} & \tcode{201304L} \\ \rowsep \defnxname{cpp_deduction_guides} & \tcode{201907L} \\ \rowsep @@ -1744,6 +1743,7 @@ \defnxname{cpp_guaranteed_copy_elision} & \tcode{201606L} \\ \rowsep \defnxname{cpp_hex_float} & \tcode{201603L} \\ \rowsep \defnxname{cpp_if_constexpr} & \tcode{201606L} \\ \rowsep +\defnxname{cpp_impl_coroutine} & \tcode{201902L} \\ \rowsep \defnxname{cpp_impl_destroying_delete} & \tcode{201806L} \\ \rowsep \defnxname{cpp_impl_three_way_comparison} & \tcode{201907L} \\ \rowsep \defnxname{cpp_inheriting_constructors} & \tcode{201511L} \\ \rowsep diff --git a/source/ranges.tex b/source/ranges.tex index 3d34a50710..78fa71527d 100644 --- a/source/ranges.tex +++ b/source/ranges.tex @@ -24,6 +24,7 @@ \rSec1[ranges.syn]{Header \tcode{} synopsis} \indexheader{ranges}% +\indexlibraryglobal{all_t}% \begin{codeblock} #include // see \ref{compare.syn} #include // see \ref{initializer.list.syn} @@ -52,10 +53,10 @@ concept range = @\seebelow@; template - inline constexpr bool enable_safe_range = false; + inline constexpr bool enable_borrowed_range = false; template - concept safe_range = @\seebelow@; + concept borrowed_range = @\seebelow@; template using iterator_t = decltype(ranges::begin(declval())); @@ -63,6 +64,8 @@ using sentinel_t = decltype(ranges::end(declval())); template using range_difference_t = iter_difference_t>; + template + using range_size_t = decltype(ranges::size(declval())); template using range_value_t = iter_value_t>; template @@ -124,17 +127,17 @@ class subrange; template S, subrange_kind K> - inline constexpr bool enable_safe_range> = true; + inline constexpr bool enable_borrowed_range> = true; // \ref{range.dangling}, dangling iterator handling struct dangling; template - using safe_iterator_t = conditional_t, iterator_t, dangling>; + using borrowed_iterator_t = conditional_t, iterator_t, dangling>; template - using safe_subrange_t = - conditional_t, subrange>, dangling>; + using borrowed_subrange_t = + conditional_t, subrange>, dangling>; // \ref{range.empty}, empty view template @@ -142,7 +145,7 @@ class empty_view; template - inline constexpr bool enable_safe_range> = true; + inline constexpr bool enable_borrowed_range> = true; namespace views { template @@ -162,7 +165,7 @@ class iota_view; template - inline constexpr bool enable_safe_range> = true; + inline constexpr bool enable_borrowed_range> = true; namespace views { inline constexpr @\unspec@ iota = @\unspec@; } @@ -174,17 +177,19 @@ basic_istream_view istream_view(basic_istream& s); // \ref{range.all}, all view - namespace views { inline constexpr @\unspec@ all = @\unspec@; } + namespace views { + inline constexpr @\unspec@ all = @\unspec@; - template - using all_view = decltype(views::all(declval())); + template + using all_t = decltype(all(declval())); + } template requires is_object_v class ref_view; template - inline constexpr bool enable_safe_range> = true; + inline constexpr bool enable_borrowed_range> = true; // \ref{range.filter}, filter view template> Pred> @@ -272,9 +277,9 @@ class elements_view; template - using keys_view = elements_view, 0>; + using keys_view = elements_view, 0>; template - using values_view = elements_view, 1>; + using values_view = elements_view, 1>; namespace views { template @@ -298,6 +303,14 @@ struct tuple_element<1, ranges::subrange> { using type = S; }; + template + struct tuple_element<0, const ranges::subrange> { + using type = I; + }; + template + struct tuple_element<1, const ranges::subrange> { + using type = S; + }; } \end{codeblock} @@ -329,7 +342,7 @@ Given a subexpression \tcode{E} and an lvalue \tcode{t} that denotes the same object as \tcode{E}, if \tcode{E} is an rvalue and -\tcode{enable_safe_range>} is \tcode{false}, +\tcode{enable_borrowed_range>} is \tcode{false}, \tcode{ranges::begin(E)} is ill-formed. Otherwise, \tcode{ranges::begin(E)} is @@ -376,7 +389,7 @@ Given a subexpression \tcode{E} and an lvalue \tcode{t} that denotes the same object as \tcode{E}, if \tcode{E} is an rvalue and -\tcode{enable_safe_range>} is \tcode{false}, +\tcode{enable_borrowed_range>} is \tcode{false}, \tcode{ranges::end(E)} is ill-formed. Otherwise, \tcode{ranges::end(E)} is @@ -467,7 +480,7 @@ Given a subexpression \tcode{E} and an lvalue \tcode{t} that denotes the same object as \tcode{E}, if \tcode{E} is an rvalue and -\tcode{enable_safe_range>} is \tcode{false}, +\tcode{enable_borrowed_range>} is \tcode{false}, \tcode{ranges::rbegin(E)} is ill-formed. Otherwise, \tcode{ranges::rbegin(E)} is @@ -515,7 +528,7 @@ Given a subexpression \tcode{E} and an lvalue \tcode{t} that denotes the same object as \tcode{E}, if \tcode{E} is an rvalue and -\tcode{enable_safe_range>} is \tcode{false}, +\tcode{enable_borrowed_range>} is \tcode{false}, \tcode{ranges::rend(E)} is ill-formed. Otherwise, \tcode{ranges::rend(E)} is @@ -836,37 +849,37 @@ \begin{itemdecl} template - concept @\deflibconcept{safe_range}@ = + concept @\deflibconcept{borrowed_range}@ = range && - (is_lvalue_reference_v || enable_safe_range>); + (is_lvalue_reference_v || enable_borrowed_range>); \end{itemdecl} \begin{itemdescr} \pnum Given an expression \tcode{E} such that \tcode{decltype((E))} is \tcode{T}, -\tcode{T} models \libconcept{safe_range} only if +\tcode{T} models \libconcept{borrowed_range} only if the validity of iterators obtained from the object denoted by \tcode{E} is not tied to the lifetime of that object. \pnum \begin{note} Since the validity of iterators is not tied to the lifetime of -an object whose type models \libconcept{safe_range}, +an object whose type models \libconcept{borrowed_range}, a function can accept arguments of such a type by value and return iterators obtained from it without danger of dangling. \end{note} \end{itemdescr} -\indexlibraryglobal{enable_safe_range}% +\indexlibraryglobal{enable_borrowed_range}% \begin{itemdecl} template - inline constexpr bool enable_safe_range = false; + inline constexpr bool enable_borrowed_range = false; \end{itemdecl} \begin{itemdescr} \pnum \remarks -Pursuant to \ref{namespace.std}, users may specialize \tcode{enable_safe_range} +Pursuant to \ref{namespace.std}, users may specialize \tcode{enable_borrowed_range} for cv-unqualified program-defined types. Such specializations shall be usable in constant expressions\iref{expr.const} and @@ -875,10 +888,10 @@ \pnum \begin{example} Each specialization \tcode{S} of class template \tcode{subrange}\iref{range.subrange} -models \libconcept{safe_range} because +models \libconcept{borrowed_range} because \begin{itemize} \item -\tcode{enable_safe_range} is specialized +\tcode{enable_borrowed_range} is specialized to have the value \tcode{true}, and \item @@ -908,7 +921,7 @@ Given an lvalue \tcode{t} of type \tcode{remove_reference_t}, \tcode{T} models \libconcept{sized_range} only if \begin{itemize} -\item \tcode{ranges::size(t)} is \bigoh{1}, does not modify \tcode{t}, +\item \tcode{ranges::size(t)} is amortized \bigoh{1}, does not modify \tcode{t}, and is equal to \tcode{ranges::distance(t)}, and \item if \tcode{iterator_t} models \libconcept{forward_iterator}, @@ -923,13 +936,6 @@ only if evaluated before the first call to \tcode{ranges::begin(t)}. \end{note} \end{itemize} - -\pnum -\begin{note} -The complexity requirement for the evaluation of \tcode{ranges::size} -is non-amortized, unlike the case for the complexity of the evaluations of -\tcode{ranges::begin} and \tcode{ranges::end} in the \libconcept{range} concept. -\end{note} \end{itemdescr} \indexlibraryglobal{disable_sized_range}% @@ -1076,6 +1082,12 @@ }; \end{itemdecl} +\pnum +Given an expression \tcode{t} such that \tcode{decltype((t))} is \tcode{T\&}, +\tcode{T} models \libconcept{contiguous_range} only if +\tcode{to_address(\brk{}ranges::begin(t)) == ranges::data(t)} +is \tcode{true}. + \pnum The \libconcept{common_range} concept specifies requirements of a \libconcept{range} type for which \tcode{ranges::begin} and @@ -1097,7 +1109,7 @@ \begin{itemdecl} template concept @\deflibconcept{viewable_range}@ = - range && (safe_range || view>); + range && (borrowed_range || view>); \end{itemdecl} \rSec1[range.utility]{Range utilities} @@ -1255,6 +1267,13 @@ \indexlibraryglobal{subrange}% \begin{codeblock} namespace std::ranges { + template + concept @\defexposconcept{convertible-to-non-slicing}@ = // \expos + convertible_to && + !(is_pointer_v> && + is_pointer_v> && + @\exposconcept{not-same-as}@>, remove_pointer_t>>); + template concept @\defexposconcept{pair-like}@ = // \expos !is_reference_v && requires(T t) { @@ -1266,17 +1285,12 @@ { get<1>(t) } -> convertible_to&>; }; - template - concept @\defexposconcept{pair-like-convertible-to}@ = // \expos - !range && @\exposconcept{pair-like}@> && - requires(T&& t) { - { get<0>(std::forward(t)) } -> convertible_to; - { get<1>(std::forward(t)) } -> convertible_to; - }; - template concept @\defexposconcept{pair-like-convertible-from}@ = // \expos - !range && @\exposconcept{pair-like}@ && constructible_from; + !range && @\exposconcept{pair-like}@ && + constructible_from && + @\exposconcept{convertible-to-non-slicing}@> && + convertible_to>; template concept @\defexposconcept{iterator-sentinel-pair}@ = // \expos @@ -1297,37 +1311,26 @@ public: subrange() = default; - constexpr subrange(I i, S s) requires (!@\exposid{StoreSize}@); + constexpr subrange(@\exposconcept{convertible-to-non-slicing}@ auto i, S s) requires (!@\exposid{StoreSize}@); - constexpr subrange(I i, S s, @\placeholdernc{make-unsigned-like-t}@> n) + constexpr subrange(@\exposconcept{convertible-to-non-slicing}@ auto i, S s, + @\placeholdernc{make-unsigned-like-t}@> n) requires (K == subrange_kind::sized); template<@\exposconcept{not-same-as}@ R> - requires safe_range && - convertible_to, I> && convertible_to, S> + requires borrowed_range && + @\exposconcept{convertible-to-non-slicing}@, I> && + convertible_to, S> constexpr subrange(R&& r) requires (!@\exposid{StoreSize}@ || sized_range); - template - requires convertible_to, I> && convertible_to, S> + template + requires @\exposconcept{convertible-to-non-slicing}@, I> && + convertible_to, S> constexpr subrange(R&& r, @\placeholdernc{make-unsigned-like-t}@> n) requires (K == subrange_kind::sized) : subrange{ranges::begin(r), ranges::end(r), n} {} - template<@\exposconcept{not-same-as}@ PairLike> - requires @\exposconcept{pair-like-convertible-to}@ - constexpr subrange(PairLike&& r) requires (!@\exposid{StoreSize}@) - : subrange{std::get<0>(std::forward(r)), - std::get<1>(std::forward(r))} - {} - - template<@\exposconcept{pair-like-convertible-to}@ PairLike> - constexpr subrange(PairLike&& r, @\placeholdernc{make-unsigned-like-t}@> n) - requires (K == subrange_kind::sized) - : subrange{std::get<0>(std::forward(r)), - std::get<1>(std::forward(r)), n} - {} - template<@\exposconcept{not-same-as}@ PairLike> requires @\exposconcept{pair-like-convertible-from}@ constexpr operator PairLike() const; @@ -1348,6 +1351,9 @@ constexpr subrange& advance(iter_difference_t n); }; + template S> + subrange(I, S) -> subrange; + template S> subrange(I, S, @\placeholdernc{make-unsigned-like-t}@>) -> subrange; @@ -1359,13 +1365,13 @@ subrange(P, @\placeholdernc{make-unsigned-like-t}@>>) -> subrange, tuple_element_t<1, P>, subrange_kind::sized>; - template + template subrange(R&&) -> subrange, sentinel_t, (sized_range || sized_sentinel_for, iterator_t>) ? subrange_kind::sized : subrange_kind::unsized>; - template + template subrange(R&&, @\placeholdernc{make-unsigned-like-t}@>) -> subrange, sentinel_t, subrange_kind::sized>; @@ -1387,7 +1393,7 @@ \indexlibraryctor{subrange}% \begin{itemdecl} -constexpr subrange(I i, S s) requires (!@\exposid{StoreSize}@); +constexpr subrange(@\exposconcept{convertible-to-non-slicing}@ auto i, S s) requires (!@\exposid{StoreSize}@); \end{itemdecl} \begin{itemdescr} @@ -1403,7 +1409,8 @@ \indexlibraryctor{subrange}% \begin{itemdecl} -constexpr subrange(I i, S s, @\placeholdernc{make-unsigned-like-t}@> n) +constexpr subrange(@\exposconcept{convertible-to-non-slicing}@ auto i, S s, + @\placeholdernc{make-unsigned-like-t}@> n) requires (K == subrange_kind::sized); \end{itemdecl} @@ -1431,8 +1438,9 @@ \indexlibraryctor{subrange}% \begin{itemdecl} template<@\exposconcept{not-same-as}@ R> - requires safe_range && - convertible_to, I> && convertible_to, S> + requires borrowed_range && + @\exposconcept{convertible-to-non-slicing}@, I> && + convertible_to, S> constexpr subrange(R&& r) requires (!@\exposid{StoreSize}@ || sized_range); \end{itemdecl} @@ -1623,13 +1631,13 @@ \pnum The tag type \tcode{dangling} is used together -with the template aliases \tcode{safe_iterator_t} and \tcode{safe_subrange_t} +with the template aliases \tcode{borrowed_iterator_t} and \tcode{borrowed_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 \libconcept{safe_range}\iref{range.range}. +which does not model \libconcept{borrowed_range}\iref{range.range}. \indexlibraryglobal{dangling}% \begin{codeblock} namespace std::ranges { @@ -1659,7 +1667,7 @@ 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 \libconcept{safe_range}. +model \libconcept{borrowed_range}. \end{example} \rSec1[range.factories]{Range factories} @@ -2152,8 +2160,7 @@ requires totally_ordered; friend constexpr bool operator>=(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires totally_ordered; - friend constexpr compare_three_way_result_t operator<=>( - const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) + friend constexpr auto operator<=>(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires totally_ordered && three_way_comparable; friend constexpr @\exposid{iterator}@ operator+(@\exposid{iterator}@ i, difference_type n) @@ -2407,9 +2414,8 @@ \indexlibrarymember{operator<=>}{iota_view::iterator} \begin{itemdecl} -friend constexpr compare_three_way_result_t - operator<=>(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) - requires totally_ordered && three_way_comparable; +friend constexpr auto operator<=>(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) + requires totally_ordered && three_way_comparable; \end{itemdecl} \begin{itemdescr} @@ -2643,7 +2649,7 @@ template class basic_istream_view::@\exposid{iterator}@ { // \expos public: - using iterator_category = input_iterator_tag; + using iterator_concept = input_iterator_tag; using difference_type = ptrdiff_t; using value_type = Val; @@ -2863,6 +2869,7 @@ \rSec2[range.all]{All view} \pnum +\indexlibraryglobal{all}% \tcode{views::all} returns a \libconcept{view} that includes all elements of its \libconcept{range} argument. @@ -3007,7 +3014,7 @@ }; template - filter_view(R&&, Pred) -> filter_view, Pred>; + filter_view(R&&, Pred) -> filter_view, Pred>; } \end{codeblock} @@ -3109,7 +3116,7 @@ \end{itemize} \pnum -\tcode{iterator::iterator_category} is defined as follows: +\tcode{\exposid{iterator}::iterator_category} is defined as follows: \begin{itemize} \item Let \tcode{C} denote the type \tcode{iterator_traits>::iterator_category}. @@ -3423,7 +3430,7 @@ }; template - transform_view(R&&, F) -> transform_view, F>; + transform_view(R&&, F) -> transform_view, F>; } \end{codeblock} @@ -3589,9 +3596,8 @@ requires random_access_range<@\exposid{Base}@>; friend constexpr bool operator>=(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires random_access_range<@\exposid{Base}@>; - friend constexpr compare_three_way_result_t> - operator<=>(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) - requires random_access_range<@\exposid{Base}@> && three_way_comparable>; + friend constexpr auto operator<=>(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) + requires random_access_range<@\exposid{Base}@> && three_way_comparable>; friend constexpr @\exposid{iterator}@ operator+(@\exposid{iterator}@ i, difference_type n) requires random_access_range<@\exposid{Base}@>; @@ -3635,12 +3641,26 @@ \end{itemize} \pnum +\tcode{iterator::iterator_category} is defined as follows: Let \tcode{C} denote the type \tcode{iterator_traits>::iterator_category}. -If \tcode{C} models \tcode{\libconcept{derived_from}}, -then \tcode{iterator_category} denotes -\tcode{random_access_iterator_tag}; otherwise, +\begin{itemize} +\item +If \tcode{is_lvalue_reference_v>>} +is \tcode{true}, then +\begin{itemize} +\item +if \tcode{C} models \tcode{\libconcept{derived_from}}, +\tcode{iterator_category} denotes \tcode{random_access_iterator_tag}; + +\item +otherwise, \tcode{iterator_category} denotes \tcode{C}. +\end{itemize} + +\item +Otherwise, \tcode{iterator_category} denotes \tcode{input_iterator_tag}. +\end{itemize} \indexlibrarymember{iterator}{transform_view::iterator} \begin{itemdecl} @@ -3857,9 +3877,8 @@ \indexlibrarymember{operator<=>}{transform_view::iterator}% \begin{itemdecl} -friend constexpr compare_three_way_result_t> - operator<=>(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) - requires random_access_range<@\exposid{Base}@> && three_way_comparable>; +friend constexpr auto operator<=>(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) + requires random_access_range<@\exposid{Base}@> && three_way_comparable>; \end{itemdecl} \begin{itemdescr} @@ -4021,7 +4040,7 @@ \begin{itemdescr} \pnum \effects -Equivalent to: \tcode{return x.\exposid{end_} - y.\exposid{current_};} +Equivalent to: \tcode{return y.\exposid{end_} - x.\exposid{current_};} \end{itemdescr} \rSec2[range.take]{Take view} @@ -4130,7 +4149,7 @@ template take_view(R&&, range_difference_t) - -> take_view>; + -> take_view>; } \end{codeblock} @@ -4264,7 +4283,7 @@ // \ref{range.take.while.sentinel}, class template \tcode{take_while_view::\exposid{sentinel}} template class @\exposid{sentinel}@; // \expos - V @\exposid{base_}@; // \expos + V @\exposid{base_}@ = V(); // \expos @\placeholder{semiregular-box}@ @\exposid{pred_}@; @\itcorr[-1]@ // \expos public: @@ -4290,7 +4309,7 @@ }; template - take_while_view(R&&, Pred) -> take_while_view, Pred>; + take_while_view(R&&, Pred) -> take_while_view, Pred>; } \end{codeblock} @@ -4451,12 +4470,12 @@ return s < c ? 0 : s - c; } private: - V @\exposid{base_}@; // \expos - range_difference_t @\exposid{count_}@; // \expos + V @\exposid{base_}@ = V(); // \expos + range_difference_t @\exposid{count_}@ = 0; // \expos }; template - drop_view(R&&, range_difference_t) -> drop_view>; + drop_view(R&&, range_difference_t) -> drop_view>; } \end{codeblock} @@ -4557,12 +4576,12 @@ { return ranges::end(@\exposid{base_}@); } private: - V @\exposid{base_}@; // \expos + V @\exposid{base_}@ = V(); // \expos @\placeholder{semiregular-box}@ @\exposid{pred_}@; @\itcorr[-1]@ // \expos }; template - drop_while_view(R&&, Pred) -> drop_while_view, Pred>; + drop_while_view(R&&, Pred) -> drop_while_view, Pred>; } \end{codeblock} @@ -4662,8 +4681,8 @@ struct @\exposid{sentinel}@; // \expos V @\exposid{base_}@ = V(); // \expos - all_view<@\exposid{InnerRng}@> @\exposid{inner_}@ = // \expos, present only when \tcode{!is_reference_v<\exposid{InnerRng}>} - all_view<@\exposid{InnerRng}@>(); + views::all_t<@\exposid{InnerRng}@> @\exposid{inner_}@ = // \expos, present only when \tcode{!is_reference_v<\exposid{InnerRng}>} + views::all_t<@\exposid{InnerRng}@>(); public: join_view() = default; constexpr explicit join_view(V base); @@ -4705,7 +4724,7 @@ }; template - explicit join_view(R&&) -> join_view>; + explicit join_view(R&&) -> join_view>; } \end{codeblock} @@ -5153,7 +5172,7 @@ constexpr split_view(V base, Pattern pattern); template - requires constructible_from> && + requires constructible_from> && constructible_from>> constexpr split_view(R&& r, range_value_t e); @@ -5186,11 +5205,11 @@ }; template - split_view(R&&, P&&) -> split_view, all_view

>; + split_view(R&&, P&&) -> split_view, views::all_t

>; template split_view(R&&, range_value_t) - -> split_view, single_view>>; + -> split_view, single_view>>; } \end{codeblock} @@ -5209,7 +5228,7 @@ \indexlibraryctor{split_view}% \begin{itemdecl} template - requires constructible_from> && + requires constructible_from> && constructible_from>> constexpr split_view(R&& r, range_value_t e); \end{itemdecl} @@ -5687,7 +5706,7 @@ constexpr explicit common_view(V r); template - requires (!common_range && constructible_from>) + requires (!common_range && constructible_from>) constexpr explicit common_view(R&& r); constexpr V base() const& requires copy_constructible { return @\exposid{base_}@; } @@ -5730,7 +5749,7 @@ }; template - common_view(R&&) -> common_view>; + common_view(R&&) -> common_view>; } \end{codeblock} @@ -5748,7 +5767,7 @@ \indexlibraryctor{common_view}% \begin{itemdecl} template - requires (!common_range && constructible_from>) + requires (!common_range && constructible_from>) constexpr explicit common_view(R&& r); \end{itemdecl} @@ -5832,12 +5851,10 @@ constexpr reverse_iterator> begin(); constexpr reverse_iterator> begin() requires common_range; - constexpr reverse_iterator> begin() const - requires common_range; + constexpr auto begin() const requires common_range; constexpr reverse_iterator> end(); - constexpr reverse_iterator> end() const - requires common_range; + constexpr auto end() const requires common_range; constexpr auto size() requires sized_range { return ranges::size(@\exposid{base_}@); @@ -5848,7 +5865,7 @@ }; template - reverse_view(R&&) -> reverse_view>; + reverse_view(R&&) -> reverse_view>; } \end{codeblock} @@ -5885,8 +5902,7 @@ \indexlibrarymember{begin}{reverse_view}% \begin{itemdecl} constexpr reverse_iterator> begin() requires common_range; -constexpr reverse_iterator> begin() const - requires common_range; +constexpr auto begin() const requires common_range; \end{itemdecl} \begin{itemdescr} @@ -5898,8 +5914,7 @@ \indexlibrarymember{end}{reverse_view}% \begin{itemdecl} constexpr reverse_iterator> end(); -constexpr reverse_iterator> end() const - requires common_range; +constexpr auto end() const requires common_range; \end{itemdecl} \begin{itemdescr} @@ -5923,7 +5938,7 @@ a range adaptor object\iref{range.adaptor.object}. Given a subexpression \tcode{E} and constant expression \tcode{N}, the expression \tcode{views::elements(E)} is expression-equivalent to -\tcode{elements_view, N>\{E\}}. +\tcode{elements_view, N>\{E\}}. \begin{example} \begin{codeblock} @@ -5947,7 +5962,7 @@ \end{example} \pnum -\tcode{keys_view} is an alias for \tcode{elements_view, 0>}, and +\tcode{keys_view} is an alias for \tcode{elements_view, 0>}, and is useful for extracting keys from associative containers. \begin{example} @@ -5960,7 +5975,7 @@ \end{example} \pnum -\tcode{values_view} is an alias for \tcode{elements_view, 1>}, and +\tcode{values_view} is an alias for \tcode{elements_view, 1>}, and is useful for extracting values from associative containers. \begin{example} @@ -6045,9 +6060,8 @@ template class elements_view::@\exposid{iterator}@ { // \expos using @\exposid{base-t}@ = conditional_t; // \expos - friend @\exposid{iterator}@; - iterator_t<@\exposid{base-t}@> @\exposid{current_}@; + iterator_t<@\exposid{base-t}@> @\exposid{current_}@ = iterator_t<@\exposid{base-t}@>(); public: using iterator_category = typename iterator_traits>::iterator_category; using value_type = remove_cvref_t>>; @@ -6093,9 +6107,8 @@ requires random_access_range<@\exposid{base-t}@>; friend constexpr bool operator>=(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) requires random_access_range<@\exposid{base-t}@>; - friend constexpr compare_three_way_result_t> - operator<=>(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) - requires random_access_range<@\exposid{base-t}@> && three_way_comparable>; + friend constexpr auto operator<=>(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) + requires random_access_range<@\exposid{base-t}@> && three_way_comparable>; friend constexpr @\exposid{iterator}@ operator+(const @\exposid{iterator}@& x, difference_type y) requires random_access_range<@\exposid{base-t}@>; @@ -6340,9 +6353,8 @@ \indexlibrarymember{operator<=>}{elements_view::iterator}% \begin{itemdecl} -friend constexpr compare_three_way_result_t> - operator<=>(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) - requires random_access_range<@\exposid{base-t}@> && three_way_comparable>; +friend constexpr auto operator<=>(const @\exposid{iterator}@& x, const @\exposid{iterator}@& y) + requires random_access_range<@\exposid{base-t}@> && three_way_comparable>; \end{itemdecl} \begin{itemdescr} diff --git a/source/strings.tex b/source/strings.tex index d2f212c5d2..7dee40d353 100644 --- a/source/strings.tex +++ b/source/strings.tex @@ -3938,7 +3938,7 @@ template inline constexpr bool ranges::enable_view> = true; template - inline constexpr bool ranges::enable_safe_range> = true; + inline constexpr bool ranges::enable_borrowed_range> = true; // \ref{string.view.comparison}, non-member comparison functions template diff --git a/source/support.tex b/source/support.tex index e482f0078f..9168450d20 100644 --- a/source/support.tex +++ b/source/support.tex @@ -597,6 +597,7 @@ #define @\defnlibxname{cpp_lib_constexpr_tuple}@ 201811L // also in \libheader{tuple} #define @\defnlibxname{cpp_lib_constexpr_utility}@ 201811L // also in \libheader{utility} #define @\defnlibxname{cpp_lib_constexpr_vector}@ 201907L // also in \libheader{vector} +#define @\defnlibxname{cpp_lib_coroutine}@ 201902L // also in \libheader{coroutine} #define @\defnlibxname{cpp_lib_destroying_delete}@ 201806L // also in \libheader{new} #define @\defnlibxname{cpp_lib_enable_shared_from_this}@ 201603L // also in \libheader{memory} #define @\defnlibxname{cpp_lib_endian}@ 201907L // also in \libheader{bit} @@ -2864,12 +2865,13 @@ may be used in a core constant expression whenever the value of its argument may be used in a core constant expression. -A byte of storage is +A byte of storage \placeholder{b} is reachable through a pointer value that points to an object \placeholder{Y} -if it is within the storage occupied by -\placeholder{Y}, -an object that is pointer-interconvertible with \placeholder{Y}, or +if there is an object \placeholder{Z}, +pointer-interconvertible with \placeholder{Y}, +such that \placeholder{b} is within the storage occupied by +\placeholder{Z}, or the immediately-enclosing array object if \placeholder{Y} is an array element. \pnum @@ -3266,17 +3268,17 @@ \pnum \remarks -When a default member initializer -is used to initialize a non-static data member, -any calls to \tcode{current} should correspond to the location -of the constructor or aggregate initialization that initializes the member. - -\pnum -\begin{note} -When used as a default argument\iref{dcl.fct.default}, -the value of the \tcode{source_location} will be -the location of the call to \tcode{current} at the call site. -\end{note} +Any call to \tcode{current} that appears +as a default member initializer\iref{class.mem}, or +as a subexpression thereof, +should correspond to the location of +the constructor definition or aggregate initialization +that uses the default member initializer. +Any call to \tcode{current} that appears +as a default argument\iref{dcl.fct.default}, or +as a subexpression thereof, +should correspond to the location of the invocation of the function +that uses the default argument\iref{expr.call}. \end{itemdescr} \pnum diff --git a/source/threads.tex b/source/threads.tex index 4dac305996..3d08aa8621 100644 --- a/source/threads.tex +++ b/source/threads.tex @@ -609,9 +609,7 @@ bool request_stop() noexcept; [[nodiscard]] friend bool - operator==(const stop_source& lhs, const stop_source& rhs) noexcept; - [[nodiscard]] friend bool - operator!=(const stop_source& lhs, const stop_source& rhs) noexcept; + operator==(const stop_source& lhs, const stop_source& rhs) noexcept; friend void swap(stop_source& lhs, stop_source& rhs) noexcept; }; } @@ -810,11 +808,12 @@ otherwise \tcode{false}. \end{itemdescr} -\rSec3[stopsource.cmp]{Comparisons} +\rSec3[stopsource.nonmembers]{Non-member functions} \indexlibrarymember{operator==}{stop_source}% \begin{itemdecl} -[[nodiscard]] bool operator==(const stop_source& lhs, const stop_source& rhs) noexcept; +[[nodiscard]] friend bool + operator==(const stop_source& lhs, const stop_source& rhs) noexcept; \end{itemdecl} \begin{itemdescr} @@ -826,19 +825,6 @@ otherwise \tcode{false}. \end{itemdescr} -\indexlibrarymember{operator!=}{stop_source}% -\begin{itemdecl} -[[nodiscard]] bool operator!=(const stop_source& lhs, const stop_source& rhs) noexcept; -\end{itemdecl} - -\begin{itemdescr} -\pnum -\returns -\tcode{!(lhs==rhs)}. -\end{itemdescr} - -\rSec3[stopsource.special]{Specialized algorithms} - \indexlibrarymember{swap}{stop_source}% \begin{itemdecl} friend void swap(stop_source& x, stop_source& y) noexcept; diff --git a/source/time.tex b/source/time.tex index bbf398acf6..6390640538 100644 --- a/source/time.tex +++ b/source/time.tex @@ -793,8 +793,9 @@ bool operator>=(const leap& x, const sys_time& y); template bool operator>=(const sys_time& x, const leap& y); - template Duration> - auto operator<=>(const leap& x, const sys_time& y); + template + requires three_way_comparable_with> + constexpr auto operator<=>(const leap& x, const sys_time& y); // \ref{time.zone.link}, class \tcode{link} class link; @@ -1288,7 +1289,7 @@ \begin{itemdescr} \pnum \constraints -\tcode{is_convertible_v} is \tcode{true} and +\tcode{is_convertible_v} is \tcode{true} and \begin{itemize} \item \tcode{treat_as_floating_point_v} is \tcode{true} or \item \tcode{treat_as_floating_point_v} is \tcode{false}. @@ -1594,7 +1595,7 @@ \begin{itemdescr} \pnum \constraints -\tcode{is_convertible_v>} is \tcode{true}. +\tcode{is_convertible_v>} is \tcode{true}. \pnum \returns @@ -1611,7 +1612,7 @@ \begin{itemdescr} \pnum \constraints -\tcode{is_convertible_v>} is \tcode{true}. +\tcode{is_convertible_v>} is \tcode{true}. \pnum \returns @@ -1628,7 +1629,7 @@ \begin{itemdescr} \pnum \constraints -\tcode{is_convertible_v>} is \tcode{true} +\tcode{is_convertible_v>} is \tcode{true} and \tcode{Rep2} is not a specialization of \tcode{duration}. \pnum @@ -1663,7 +1664,7 @@ \begin{itemdescr} \pnum \constraints -\tcode{is_convertible_v>} is \tcode{true} and +\tcode{is_convertible_v>} is \tcode{true} and \tcode{Rep2} is not a specialization of \tcode{duration}. \pnum @@ -2049,11 +2050,11 @@ \item Otherwise, if \tcode{Period::type} is \tcode{micro}, -\tcode{\placeholder{units-suffix}} is: -\begin{itemize} -\item \tcode{"\textmu{}s"} (\tcode{"\textbackslash{}u00b5\textbackslash{}u0073"}) if the character U+00B5 can be represented in the encoding used for \tcode{charT}; -\item \tcode{"us"} otherwise. -\end{itemize} +it is +\impldef{unit suffix when \tcode{Period::type} is \tcode{micro}} +whether \tcode{\placeholder{units-suffix}} is +\tcode{"\textmu{}s"} (\tcode{"\textbackslash{}u00b5\textbackslash{}u0073"}) or +\tcode{"us"}. \item Otherwise, if \tcode{Period::type} is \tcode{milli}, @@ -2843,7 +2844,8 @@ A \tcode{sys_time} \tcode{t}, such that \tcode{from_sys(t) == u} if such a mapping exists. Otherwise \tcode{u} represents a \tcode{time_point} -during a leap second insertion +during a positive leap second insertion, +the conversion counts that leap second as not inserted, and the last representable value of \tcode{sys_time} prior to the insertion of the leap second is returned. \end{itemdescr} @@ -2860,7 +2862,7 @@ \returns A \tcode{utc_time} \tcode{u}, such that \tcode{u.time_since_epoch() - t.time_since_epoch()} -is equal to the number of leap seconds that were inserted +is equal to the sum of leap seconds that were inserted between \tcode{t} and 1970-01-01. If \tcode{t} is exactly the date of leap second insertion, then the conversion counts that leap second as inserted. @@ -2980,11 +2982,13 @@ \begin{itemdescr} \pnum \returns -A \tcode{leap_second_info} where \tcode{is_leap_second} is \tcode{true} -if \tcode{ut} is during a leap second insertion, and otherwise \tcode{false}. -\tcode{elapsed} is the number of leap seconds between 1970-01-01 and \tcode{ut}. -If \tcode{is_leap_second} is \tcode{true}, -the leap second referred to by \tcode{ut} is included in the count. +A \tcode{leap_second_info} \tcode{lsi}, +where \tcode{lsi.is_leap_second} is \tcode{true} +if \tcode{ut} is during a positive leap second insertion, and +otherwise \tcode{false}. +\tcode{lsi.elapsed} is the sum of leap seconds between 1970-01-01 and \tcode{ut}. +If \tcode{lsi.is_leap_second} is \tcode{true}, +the leap second referred to by \tcode{ut} is included in the sum. \end{itemdescr} \rSec2[time.clock.tai]{Class \tcode{tai_clock}} @@ -3020,8 +3024,9 @@ That is, 1958-01-01 00:00:00 TAI is equivalent to 1957-12-31 23:59:50 UTC\@. Leap seconds are not inserted into TAI\@. Therefore every time a leap second is inserted into UTC, -UTC falls another second behind TAI\@. -For example by 2000-01-01 there had been 22 leap seconds inserted +UTC shifts another second with respect to TAI\@. +For example by 2000-01-01 there had been +22 positive and 0 negative leap seconds inserted so 2000-01-01 00:00:00 UTC is equivalent to 2000-01-01 00:00:32 TAI (22s plus the initial 10s offset). @@ -3183,7 +3188,7 @@ seconds since the first Sunday of January, 1980 00:00:00 UTC\@. Leap seconds are not inserted into GPS\@. Therefore every time a leap second is inserted into UTC, -UTC falls another second behind GPS\@. +UTC shifts another second with respect to GPS\@. Aside from the offset from \tcode{1958y/January/1} to \tcode{1980y/January/Sunday[1]}, GPS is behind TAI by 19s due to the 10s offset between 1958 and 1970 and the additional 9 leap seconds inserted between 1970 and 1980. @@ -6023,6 +6028,14 @@ \end{itemdecl} \begin{itemdescr} +\pnum +\constraints +If the argument supplied by the caller for the \tcode{months} parameter +is convertible to \tcode{years}, +its implicit conversion sequence to \tcode{years} +is worse than its implicit conversion sequence to +\tcode{months}\iref{over.ics.rank}. + \pnum \effects \tcode{*this = *this + dm}. @@ -6038,6 +6051,14 @@ \end{itemdecl} \begin{itemdescr} +\pnum +\constraints +If the argument supplied by the caller for the \tcode{months} parameter +is convertible to \tcode{years}, +its implicit conversion sequence to \tcode{years} +is worse than its implicit conversion sequence to +\tcode{months}\iref{over.ics.rank}. + \pnum \effects \tcode{*this = *this - dm}. @@ -6122,6 +6143,14 @@ \end{itemdecl} \begin{itemdescr} +\pnum +\constraints +If the argument supplied by the caller for the \tcode{months} parameter +is convertible to \tcode{years}, +its implicit conversion sequence to \tcode{years} +is worse than its implicit conversion sequence to +\tcode{months}\iref{over.ics.rank}. + \pnum \returns A \tcode{year_month} value \tcode{z} such that \tcode{z.ok() \&\& z - ym == dm} @@ -6138,6 +6167,14 @@ \end{itemdecl} \begin{itemdescr} +\pnum +\constraints +If the argument supplied by the caller for the \tcode{months} parameter +is convertible to \tcode{years}, +its implicit conversion sequence to \tcode{years} +is worse than its implicit conversion sequence to +\tcode{months}\iref{over.ics.rank}. + \pnum \returns \tcode{ym + dm}. @@ -6149,6 +6186,14 @@ \end{itemdecl} \begin{itemdescr} +\pnum +\constraints +If the argument supplied by the caller for the \tcode{months} parameter +is convertible to \tcode{years}, +its implicit conversion sequence to \tcode{years} +is worse than its implicit conversion sequence to +\tcode{months}\iref{over.ics.rank}. + \pnum \returns \tcode{ym + -dm}. @@ -6370,6 +6415,14 @@ \end{itemdecl} \begin{itemdescr} +\pnum +\constraints +If the argument supplied by the caller for the \tcode{months} parameter +is convertible to \tcode{years}, +its implicit conversion sequence to \tcode{years} +is worse than its implicit conversion sequence to +\tcode{months}\iref{over.ics.rank}. + \pnum \effects \tcode{*this = *this + m}. @@ -6385,6 +6438,14 @@ \end{itemdecl} \begin{itemdescr} +\pnum +\constraints +If the argument supplied by the caller for the \tcode{months} parameter +is convertible to \tcode{years}, +its implicit conversion sequence to \tcode{years} +is worse than its implicit conversion sequence to +\tcode{months}\iref{over.ics.rank}. + \pnum \effects \tcode{*this = *this - m}. @@ -6549,6 +6610,14 @@ \end{itemdecl} \begin{itemdescr} +\pnum +\constraints +If the argument supplied by the caller for the \tcode{months} parameter +is convertible to \tcode{years}, +its implicit conversion sequence to \tcode{years} +is worse than its implicit conversion sequence to +\tcode{months}\iref{over.ics.rank}. + \pnum \returns \tcode{(ymd.year() / ymd.month() + dm) / ymd.day()}. @@ -6567,6 +6636,14 @@ \end{itemdecl} \begin{itemdescr} +\pnum +\constraints +If the argument supplied by the caller for the \tcode{months} parameter +is convertible to \tcode{years}, +its implicit conversion sequence to \tcode{years} +is worse than its implicit conversion sequence to +\tcode{months}\iref{over.ics.rank}. + \pnum \returns \tcode{ymd + dm}. @@ -6578,6 +6655,14 @@ \end{itemdecl} \begin{itemdescr} +\pnum +\constraints +If the argument supplied by the caller for the \tcode{months} parameter +is convertible to \tcode{years}, +its implicit conversion sequence to \tcode{years} +is worse than its implicit conversion sequence to +\tcode{months}\iref{over.ics.rank}. + \pnum \returns \tcode{ymd + (-dm)}. @@ -6739,6 +6824,14 @@ \end{itemdecl} \begin{itemdescr} +\pnum +\constraints +If the argument supplied by the caller for the \tcode{months} parameter +is convertible to \tcode{years}, +its implicit conversion sequence to \tcode{years} +is worse than its implicit conversion sequence to +\tcode{months}\iref{over.ics.rank}. + \pnum \effects \tcode{*this = *this + m}. @@ -6754,6 +6847,14 @@ \end{itemdecl} \begin{itemdescr} +\pnum +\constraints +If the argument supplied by the caller for the \tcode{months} parameter +is convertible to \tcode{years}, +its implicit conversion sequence to \tcode{years} +is worse than its implicit conversion sequence to +\tcode{months}\iref{over.ics.rank}. + \pnum \effects \tcode{*this = *this - m}. @@ -6915,6 +7016,14 @@ \end{itemdecl} \begin{itemdescr} +\pnum +\constraints +If the argument supplied by the caller for the \tcode{months} parameter +is convertible to \tcode{years}, +its implicit conversion sequence to \tcode{years} +is worse than its implicit conversion sequence to +\tcode{months}\iref{over.ics.rank}. + \pnum \returns \tcode{(ymdl.year() / ymdl.month() + dm) / last}. @@ -6927,6 +7036,14 @@ \end{itemdecl} \begin{itemdescr} +\pnum +\constraints +If the argument supplied by the caller for the \tcode{months} parameter +is convertible to \tcode{years}, +its implicit conversion sequence to \tcode{years} +is worse than its implicit conversion sequence to +\tcode{months}\iref{over.ics.rank}. + \pnum \returns \tcode{ymdl + dm}. @@ -6939,6 +7056,14 @@ \end{itemdecl} \begin{itemdescr} +\pnum +\constraints +If the argument supplied by the caller for the \tcode{months} parameter +is convertible to \tcode{years}, +its implicit conversion sequence to \tcode{years} +is worse than its implicit conversion sequence to +\tcode{months}\iref{over.ics.rank}. + \pnum \returns \tcode{ymdl + (-dm)}. @@ -7098,6 +7223,14 @@ \end{itemdecl} \begin{itemdescr} +\pnum +\constraints +If the argument supplied by the caller for the \tcode{months} parameter +is convertible to \tcode{years}, +its implicit conversion sequence to \tcode{years} +is worse than its implicit conversion sequence to +\tcode{months}\iref{over.ics.rank}. + \pnum \effects \tcode{*this = *this + m}. @@ -7113,6 +7246,14 @@ \end{itemdecl} \begin{itemdescr} +\pnum +\constraints +If the argument supplied by the caller for the \tcode{months} parameter +is convertible to \tcode{years}, +its implicit conversion sequence to \tcode{years} +is worse than its implicit conversion sequence to +\tcode{months}\iref{over.ics.rank}. + \pnum \effects \tcode{*this = *this - m}. @@ -7276,6 +7417,14 @@ \end{itemdecl} \begin{itemdescr} +\pnum +\constraints +If the argument supplied by the caller for the \tcode{months} parameter +is convertible to \tcode{years}, +its implicit conversion sequence to \tcode{years} +is worse than its implicit conversion sequence to +\tcode{months}\iref{over.ics.rank}. + \pnum \returns \tcode{(ymwd.year() / ymwd.month() + dm) / ymwd.weekday_indexed()}. @@ -7287,6 +7436,14 @@ \end{itemdecl} \begin{itemdescr} +\pnum +\constraints +If the argument supplied by the caller for the \tcode{months} parameter +is convertible to \tcode{years}, +its implicit conversion sequence to \tcode{years} +is worse than its implicit conversion sequence to +\tcode{months}\iref{over.ics.rank}. + \pnum \returns \tcode{ymwd + dm}. @@ -7298,6 +7455,14 @@ \end{itemdecl} \begin{itemdescr} +\pnum +\constraints +If the argument supplied by the caller for the \tcode{months} parameter +is convertible to \tcode{years}, +its implicit conversion sequence to \tcode{years} +is worse than its implicit conversion sequence to +\tcode{months}\iref{over.ics.rank}. + \pnum \returns \tcode{ymwd + (-dm)}. @@ -7422,6 +7587,14 @@ \end{itemdecl} \begin{itemdescr} +\pnum +\constraints +If the argument supplied by the caller for the \tcode{months} parameter +is convertible to \tcode{years}, +its implicit conversion sequence to \tcode{years} +is worse than its implicit conversion sequence to +\tcode{months}\iref{over.ics.rank}. + \pnum \effects \tcode{*this = *this + m}. @@ -7437,6 +7610,14 @@ \end{itemdecl} \begin{itemdescr} +\pnum +\constraints +If the argument supplied by the caller for the \tcode{months} parameter +is convertible to \tcode{years}, +its implicit conversion sequence to \tcode{years} +is worse than its implicit conversion sequence to +\tcode{months}\iref{over.ics.rank}. + \pnum \effects \tcode{*this = *this - m}. @@ -7579,6 +7760,14 @@ \end{itemdecl} \begin{itemdescr} +\pnum +\constraints +If the argument supplied by the caller for the \tcode{months} parameter +is convertible to \tcode{years}, +its implicit conversion sequence to \tcode{years} +is worse than its implicit conversion sequence to +\tcode{months}\iref{over.ics.rank}. + \pnum \returns \tcode{(ymwdl.year() / ymwdl.month() + dm) / ymwdl.weekday_last()}. @@ -7591,6 +7780,14 @@ \end{itemdecl} \begin{itemdescr} +\pnum +\constraints +If the argument supplied by the caller for the \tcode{months} parameter +is convertible to \tcode{years}, +its implicit conversion sequence to \tcode{years} +is worse than its implicit conversion sequence to +\tcode{months}\iref{over.ics.rank}. + \pnum \returns \tcode{ymwdl + dm}. @@ -7603,6 +7800,14 @@ \end{itemdecl} \begin{itemdescr} +\pnum +\constraints +If the argument supplied by the caller for the \tcode{months} parameter +is convertible to \tcode{years}, +its implicit conversion sequence to \tcode{years} +is worse than its implicit conversion sequence to +\tcode{months}\iref{over.ics.rank}. + \pnum \returns \tcode{ymwdl + (-dm)}. @@ -8402,10 +8607,7 @@ \effects Equivalent to: \begin{codeblock} -return os << format(os.getloc(), - hms.is_negative() ? @\placeholder{STATICALLY-WIDEN}@("-{:%T}") - : @\placeholder{STATICALLY-WIDEN}@("{:%T}"), - abs(hms.to_duration())); +return os << format(os.getloc(), @\placeholder{STATICALLY-WIDEN}@("{:%T}"), hms); \end{codeblock} \pnum @@ -9417,8 +9619,10 @@ template zoned_time(TimeZonePtr z, const zoned_time& zt, choose); - zoned_time(string_view name, const zoned_time& zt); - zoned_time(string_view name, const zoned_time& zt, choose); + template + zoned_time(string_view name, const zoned_time& zt); + template + zoned_time(string_view name, const zoned_time& zt, choose); zoned_time& operator=(const sys_time& st); zoned_time& operator=(const local_time& ut); @@ -9710,13 +9914,16 @@ \end{itemdescr} \begin{itemdecl} -zoned_time(string_view name, const zoned_time& y); +template + zoned_time(string_view name, const zoned_time& y); \end{itemdecl} \begin{itemdescr} \pnum \constraints -\tcode{zoned_time} is constructible from the return type of \tcode{traits::locate_zone(name)} and \tcode{zoned_time}. +\tcode{zoned_time} is constructible from +the return type of \tcode{traits::locate_zone(name)} and +the type \tcode{zoned_time}. \pnum \effects @@ -9724,14 +9931,17 @@ \end{itemdescr} \begin{itemdecl} -zoned_time(string_view name, const zoned_time& y, choose c); +template + zoned_time(string_view name, const zoned_time& y, choose c); \end{itemdecl} \begin{itemdescr} \pnum \constraints \tcode{zoned_time} is constructible from -the return type of \tcode{traits::locate_zone(name)}, \tcode{zoned_time}, and \tcode{choose}. +the return type of \tcode{traits::locate_zone(name)}, +the type \tcode{zoned_time}, and +the type \tcode{choose}. \pnum \effects @@ -9895,13 +10105,14 @@ // unspecified additional constructors constexpr sys_seconds date() const noexcept; + constexpr seconds value() const noexcept; }; } \end{codeblock} \pnum Objects of type \tcode{leap} representing -the date of the leap second insertions +the date and value of the leap second insertions are constructed and stored in the time zone database when initialized. \pnum @@ -9909,39 +10120,39 @@ \begin{codeblock} for (auto& l : get_tzdb().leaps) if (l <= 2018y/March/17d) - cout << l.date() << '\n'; + cout << l.date() << ": " << l.value() << '\n'; \end{codeblock} Produces the output: \begin{outputblock} -1972-07-01 00:00:00 -1973-01-01 00:00:00 -1974-01-01 00:00:00 -1975-01-01 00:00:00 -1976-01-01 00:00:00 -1977-01-01 00:00:00 -1978-01-01 00:00:00 -1979-01-01 00:00:00 -1980-01-01 00:00:00 -1981-07-01 00:00:00 -1982-07-01 00:00:00 -1983-07-01 00:00:00 -1985-07-01 00:00:00 -1988-01-01 00:00:00 -1990-01-01 00:00:00 -1991-01-01 00:00:00 -1992-07-01 00:00:00 -1993-07-01 00:00:00 -1994-07-01 00:00:00 -1996-01-01 00:00:00 -1997-07-01 00:00:00 -1999-01-01 00:00:00 -2006-01-01 00:00:00 -2009-01-01 00:00:00 -2012-07-01 00:00:00 -2015-07-01 00:00:00 -2017-01-01 00:00:00 +1972-07-01 00:00:00: 1s +1973-01-01 00:00:00: 1s +1974-01-01 00:00:00: 1s +1975-01-01 00:00:00: 1s +1976-01-01 00:00:00: 1s +1977-01-01 00:00:00: 1s +1978-01-01 00:00:00: 1s +1979-01-01 00:00:00: 1s +1980-01-01 00:00:00: 1s +1981-07-01 00:00:00: 1s +1982-07-01 00:00:00: 1s +1983-07-01 00:00:00: 1s +1985-07-01 00:00:00: 1s +1988-01-01 00:00:00: 1s +1990-01-01 00:00:00: 1s +1991-01-01 00:00:00: 1s +1992-07-01 00:00:00: 1s +1993-07-01 00:00:00: 1s +1994-07-01 00:00:00: 1s +1996-01-01 00:00:00: 1s +1997-07-01 00:00:00: 1s +1999-01-01 00:00:00: 1s +2006-01-01 00:00:00: 1s +2009-01-01 00:00:00: 1s +2012-07-01 00:00:00: 1s +2015-07-01 00:00:00: 1s +2017-01-01 00:00:00: 1s \end{outputblock} \end{example} @@ -9958,6 +10169,21 @@ The date and time at which the leap second was inserted. \end{itemdescr} +\indexlibrarymember{value}{leap}% +\begin{itemdecl} +constexpr seconds value() const noexcept; +\end{itemdecl} + +\begin{itemdescr} +\pnum +\returns +\tcode{+1s} to indicate a positive leap second or +\tcode{-1s} to indicate a negative leap second. +\begin{note} +All leap seconds inserted up through 2019 were positive leap seconds. +\end{note} +\end{itemdescr} + \rSec3[time.zone.leap.nonmembers]{Non-member functions} \indexlibrarymember{operator==}{leap}% @@ -10102,7 +10328,8 @@ \indexlibrarymember{operator<=>}{leap}% \indexlibrarymember{operator<=>}{sys_time}% \begin{itemdecl} -template Duration> +template + requires three_way_comparable_with> constexpr auto operator<=>(const leap& x, const sys_time& y) noexcept; \end{itemdecl} @@ -10259,6 +10486,22 @@ the conversion specifier refers to, an exception of type \tcode{format_error} is thrown. +\pnum +The result of formatting +a \tcode{std::chrono::duration} instance holding a negative value, or +an \tcode{hh_mm_ss} object \tcode{h} for which \tcode{h.is_negative()} is \tcode{true}, +is equivalent to the output of the corresponding positive value, +with a \tcode{\exposid{STATICALLY-WIDEN}("-")} character sequence +placed before the replacement of the leftmost conversion specifier. +\begin{example} +\begin{codeblockdigitsep} +cout << format("{%:T}", -10'000s); // prints: \tcode{-02:46:40} +cout << format("{:%H:%M:%S}", -10'000s); // prints: \tcode{-02:46:40} +cout << format("{:minutes %M, hours %H, seconds %S}", -10'000s); + // prints: \tcode{minutes -46, hours 02, seconds 40} +\end{codeblockdigitsep} +\end{example} + \pnum Unless explicitly requested, the result of formatting a chrono type @@ -10376,7 +10619,10 @@ the locale's alternative representation. \\ \rowsep \tcode{\%j} & -The day of the year as a decimal number. +If the type being formatted is a specialization of \tcode{duration}, +the decimal number of \tcode{days} without padding. +Otherwise, +the day of the year as a decimal number. Jan 1 is \tcode{001}. If the result is less than three digits, it is left-padded with \tcode{0} to three digits. @@ -10546,7 +10792,7 @@ it is replaced with \tcode{\exposid{STATICALLY-WIDEN}("UTC")}. If \tcode{\%z} (or a modified variant of \tcode{\%z}) is used, an offset of \tcode{0min} is formatted. -If the argument represents a time during a leap second insertion, +If the argument represents a time during a positive leap second insertion, and if a seconds field is formatted, the integral portion of that format is \tcode{\exposid{STATICALLY-WIDEN}("60")}. @@ -10718,7 +10964,8 @@ calls \tcode{from_stream} unqualified, so as to enable argument dependent lookup\iref{basic.lookup.argdep}. In the following paragraphs, -let \tcode{is} denote an object of type \tcode{basic_istream}, +let \tcode{is} denote an object of type \tcode{basic_istream} and +let \tcode{I} be \tcode{basic_istream\&}, where \tcode{charT} and \tcode{traits} are template parameters in that context. \begin{itemdecl} @@ -10730,15 +10977,18 @@ \begin{itemdescr} \pnum \constraints +The expression \begin{codeblock} from_stream(declval&>(), fmt.c_str(), tp) \end{codeblock} -is a valid expression. +is well-formed when treated as an unevaluated operand. \pnum \returns -A manipulator that, when extracted from a -\tcode{basic_istream} \tcode{is}, +A manipulator such that +the expression \tcode{is >> parse(fmt, tp)} +has type \tcode{I}, +has value \tcode{is}, and calls \tcode{from_stream(is, fmt.c_str(), tp)}. \end{itemdescr} @@ -10752,15 +11002,18 @@ \begin{itemdescr} \pnum \constraints +The expression \begin{codeblock} from_stream(declval&>(), fmt.c_str(), tp, addressof(abbrev)) \end{codeblock} -is a valid expression. +is well-formed when treated as an unevaluated operand. \pnum \returns -A manipulator that, when extracted from a -\tcode{basic_istream} \tcode{is}, +A manipulator such that +the expression \tcode{is >> parse(fmt, tp, abbrev)} +has type \tcode{I}, +has value \tcode{is}, and calls \tcode{from_stream(is, fmt.c_str(), tp, addressof(abbrev))}. \end{itemdescr} @@ -10785,8 +11038,10 @@ \pnum \returns -A manipulator that, when extracted from a -\tcode{basic_istream} \tcode{is}, +A manipulator such that +the expression \tcode{is >> parse(fmt, tp, offset)} +has type \tcode{I}, +has value \tcode{is}, and calls: \begin{codeblock} from_stream(is, @@ -10806,16 +11061,19 @@ \begin{itemdescr} \pnum \constraints +The expression \begin{codeblock} from_stream(declval&>(), fmt.c_str(), tp, addressof(abbrev), &offset) \end{codeblock} -is a valid expression. +is well-formed when treated as an unevaluated operand. \pnum \returns -A manipulator that, when extracted from a -\tcode{basic_istream} \tcode{is}, +A manipulator such that +the expression \tcode{is >> parse(fmt, tp, abbrev, offset)} +has type \tcode{I}, +has value \tcode{is}, and calls \tcode{from_stream(is, fmt.c_str(), tp, addressof(abbrev), \&offset)}. \end{itemdescr} @@ -10887,7 +11145,7 @@ the maximum number of characters to read. If \tcode{\placeholder{N}} is not specified, the default is 2. Leading zeroes are permitted but not required. -The modified commands \tcode{\%EC} and \tcode{\%OC} interpret +The modified command \tcode{\%EC} interprets the locale's alternative representation of the century. \\ \rowsep \tcode{\%d} & @@ -10942,11 +11200,17 @@ the maximum number of characters to read. If \tcode{\placeholder{N}} is not specified, the default is 2. Leading zeroes are permitted but not required. +The modified command \tcode{\%OI} +interprets the locale's alternative representation. \\ \rowsep \tcode{\%j} & -The day of the year as a decimal number. +If the type being parsed is a specialization of \tcode{duration}, +a decimal number of \tcode{days}. +Otherwise, +the day of the year as a decimal number. Jan 1 is \tcode{1}. -The modified command \tcode{\%\placeholder{N}j} specifies +In either case, +the modified command \tcode{\%\placeholder{N}j} specifies the maximum number of characters to read. If \tcode{\placeholder{N}} is not specified, the default is 3. Leading zeroes are permitted but not required. @@ -11015,8 +11279,6 @@ the maximum number of characters to read. If \tcode{\placeholder{N}} is not specified, the default is \tcode{1}. Leading zeroes are permitted but not required. -The modified command \tcode{\%Ou} interprets -the locale's alternative representation. \\ \rowsep \tcode{\%U} & The week number of the year as a decimal number. @@ -11026,6 +11288,8 @@ the maximum number of characters to read. If \tcode{\placeholder{N}} is not specified, the default is 2. Leading zeroes are permitted but not required. +The modified command \tcode{\%OU} interprets +the locale's alternative representation. \\ \rowsep \tcode{\%V} & The ISO week-based week number as a decimal number. @@ -11051,6 +11315,8 @@ the maximum number of characters to read. If \tcode{\placeholder{N}} is not specified, the default is 2. Leading zeroes are permitted but not required. +The modified command \tcode{\%OW} interprets +the locale's alternative representation. \\ \rowsep \tcode{\%x} & The locale's date representation. diff --git a/source/utilities.tex b/source/utilities.tex index 0a787e896d..c9b314ba5c 100644 --- a/source/utilities.tex +++ b/source/utilities.tex @@ -100,6 +100,13 @@ struct pair; // \ref{pairs.spec}, pair specialized algorithms + template + constexpr bool operator==(const pair&, const pair&); + template + constexpr common_comparison_category_t<@\placeholder{synth-three-way-result}@, + @\placeholder{synth-three-way-result}@> + operator<=>(const pair&, const pair&); + template constexpr void swap(pair& x, pair& y) noexcept(noexcept(x.swap(y))); @@ -496,15 +503,6 @@ constexpr pair& operator=(pair&& p); constexpr void swap(pair& p) noexcept(@\seebelow@); - - // \ref{pairs.spec}, pair specialized algorithms - friend constexpr bool operator==(const pair&, const pair&) = default; - friend constexpr bool operator==(const pair& x, const pair& y) - requires (is_reference_v || is_reference_v) - { return x.first == y.first && x.second == y.second; } - friend constexpr common_comparison_category_t<@\placeholder{synth-three-way-result}@, - @\placeholder{synth-three-way-result}@> - operator<=>(const pair& x, const pair& y) { @\seebelow@ } }; template @@ -527,6 +525,14 @@ If \tcode{(is_trivially_destructible_v \&\& is_trivially_destructible_v)} is \tcode{true}, then the destructor of \tcode{pair} is trivial. +\pnum +\tcode{pair} is a structural type\iref{temp.param} +if \tcode{T} and \tcode{U} are both structural types. +Two values \tcode{p1} and \tcode{p2} of type \tcode{pair} +are template-argument-equivalent\iref{temp.type} if and only if +\tcode{p1.first} and \tcode{p2.first} are template-argument-equivalent and +\tcode{p1.second} and \tcode{p2.second} are template-argument-equivalent. + \indexlibraryctor{pair}% \begin{itemdecl} constexpr explicit(@\seebelow@) pair(); @@ -790,11 +796,24 @@ \rSec2[pairs.spec]{Specialized algorithms} +\indexlibrarymember{operator==}{pair}% +\begin{itemdecl} +template + constexpr bool operator==(const pair& x, const pair& y); +\end{itemdecl} + +\begin{itemdescr} +\pnum +\returns +\tcode{x.first == y.first \&\& x.second == y.second}. +\end{itemdescr} + \indexlibrarymember{operator<=>}{pair}% \begin{itemdecl} -friend constexpr - common_comparison_category_t<@\placeholder{synth-three-way-result}@, @\placeholder{synth-three-way-result}@> - operator<=>(const pair& x, const pair& y); +template + constexpr common_comparison_category_t<@\placeholder{synth-three-way-result}@, + @\placeholder{synth-three-way-result}@> + operator<=>(const pair& x, const pair& y); \end{itemdecl} \begin{itemdescr} @@ -6519,7 +6538,7 @@ template constexpr T* to_address(T* p) noexcept; template - auto to_address(const Ptr& p) noexcept; + constexpr auto to_address(const Ptr& p) noexcept; // \ref{util.dynamic.safety}, pointer safety enum class pointer_safety { relaxed, preferred, strict }; @@ -6613,7 +6632,7 @@ I uninitialized_default_construct(I first, S last); template<@\exposconcept{no-throw-forward-range}@ R> requires default_initializable> - safe_iterator_t uninitialized_default_construct(R&& r); + borrowed_iterator_t uninitialized_default_construct(R&& r); template<@\exposconcept{no-throw-forward-iterator}@ I> requires default_initializable> @@ -6637,7 +6656,7 @@ I uninitialized_value_construct(I first, S last); template<@\exposconcept{no-throw-forward-range}@ R> requires default_initializable> - safe_iterator_t uninitialized_value_construct(R&& r); + borrowed_iterator_t uninitialized_value_construct(R&& r); template<@\exposconcept{no-throw-forward-iterator}@ I> requires default_initializable> @@ -6669,7 +6688,7 @@ uninitialized_copy(I ifirst, S1 ilast, O ofirst, S2 olast); template requires constructible_from, range_reference_t> - uninitialized_copy_result, safe_iterator_t> + uninitialized_copy_result, borrowed_iterator_t> uninitialized_copy(IR&& in_range, OR&& out_range); template @@ -6705,7 +6724,7 @@ uninitialized_move(I ifirst, S1 ilast, O ofirst, S2 olast); template requires constructible_from, range_rvalue_reference_t> - uninitialized_move_result, safe_iterator_t> + uninitialized_move_result, borrowed_iterator_t> uninitialized_move(IR&& in_range, OR&& out_range); template @@ -6734,7 +6753,7 @@ I uninitialized_fill(I first, S last, const T& x); template<@\exposconcept{no-throw-forward-range}@ R, class T> requires constructible_from, const T&> - safe_iterator_t uninitialized_fill(R&& r, const T& x); + borrowed_iterator_t uninitialized_fill(R&& r, const T& x); template<@\exposconcept{no-throw-forward-iterator}@ I, class T> requires constructible_from, const T&> @@ -6773,7 +6792,7 @@ constexpr I destroy(I first, S last) noexcept; template<@\exposconcept{no-throw-input-range}@ R> requires destructible> - constexpr safe_iterator_t destroy(R&& r) noexcept; + constexpr borrowed_iterator_t destroy(R&& r) noexcept; template<@\exposconcept{no-throw-input-iterator}@ I> requires destructible> @@ -7098,7 +7117,7 @@ \indexlibraryglobal{to_address}% \begin{itemdecl} -template auto to_address(const Ptr& p) noexcept; +template constexpr auto to_address(const Ptr& p) noexcept; \end{itemdecl} \begin{itemdescr} @@ -8229,7 +8248,7 @@ I uninitialized_default_construct(I first, S last); template<@\placeholdernc{no-throw-forward-range}@ R> requires default_initializable> - safe_iterator_t uninitialized_default_construct(R&& r); + borrowed_iterator_t uninitialized_default_construct(R&& r); } \end{itemdecl} @@ -8308,7 +8327,7 @@ I uninitialized_value_construct(I first, S last); template<@\placeholdernc{no-throw-forward-range}@ R> requires default_initializable> - safe_iterator_t uninitialized_value_construct(R&& r); + borrowed_iterator_t uninitialized_value_construct(R&& r); } \end{itemdecl} @@ -8398,7 +8417,7 @@ uninitialized_copy(I ifirst, S1 ilast, O ofirst, S2 olast); template requires constructible_from, range_reference_t> - uninitialized_copy_result, safe_iterator_t> + uninitialized_copy_result, borrowed_iterator_t> uninitialized_copy(IR&& in_range, OR&& out_range); } \end{itemdecl} @@ -8415,7 +8434,7 @@ for (; ifirst != ilast && ofirst != olast; ++ofirst, (void)++ifirst) { ::new (@\placeholdernc{voidify}@(*ofirst)) remove_reference_t>(*ifirst); } -return {ifirst, ofirst}; +return {std::move(ifirst), ofirst}; \end{codeblock} \end{itemdescr} @@ -8467,7 +8486,7 @@ \begin{codeblock} auto t = uninitialized_copy(counted_iterator(ifirst, n), default_sentinel, ofirst, olast); -return {t.in.base(), t.out}; +return {std::move(t.in).base(), t.out}; \end{codeblock} \end{itemdescr} @@ -8506,7 +8525,7 @@ uninitialized_move(I ifirst, S1 ilast, O ofirst, S2 olast); template requires constructible_from, range_rvalue_reference_t> - uninitialized_move_result, safe_iterator_t> + uninitialized_move_result, borrowed_iterator_t> uninitialized_move(IR&& in_range, OR&& out_range); } \end{itemdecl} @@ -8524,7 +8543,7 @@ ::new (@\placeholder{voidify}@(*ofirst)) remove_reference_t>(ranges::iter_move(ifirst)); } -return {ifirst, ofirst}; +return {std::move(ifirst), ofirst}; \end{codeblock} \pnum @@ -8579,7 +8598,7 @@ \begin{codeblock} auto t = uninitialized_move(counted_iterator(ifirst, n), default_sentinel, ofirst, olast); -return {t.in.base(), t.out}; +return {std::move(t.in).base(), t.out}; \end{codeblock} \pnum @@ -8617,7 +8636,7 @@ I uninitialized_fill(I first, S last, const T& x); template<@\placeholdernc{no-throw-forward-range}@ R, class T> requires constructible_from, const T&> - safe_iterator_t uninitialized_fill(R&& r, const T& x); + borrowed_iterator_t uninitialized_fill(R&& r, const T& x); } \end{itemdecl} @@ -8742,7 +8761,7 @@ constexpr I destroy(I first, S last) noexcept; template<@\placeholdernc{no-throw-input-range}@ R> requires destructible> - constexpr safe_iterator_t destroy(R&& r) noexcept; + constexpr borrowed_iterator_t destroy(R&& r) noexcept; } \end{itemdecl} @@ -10200,8 +10219,14 @@ \oldconcept{CopyAssignable}, and \oldconcept{\-Less\-Than\-Comparable}, allowing their use in standard containers. Specializations of \tcode{shared_ptr} shall be contextually convertible to \tcode{bool}, -allowing their use in boolean expressions and declarations in conditions. The template -parameter \tcode{T} of \tcode{shared_ptr} may be an incomplete type. +allowing their use in boolean expressions and declarations in conditions. + +\pnum +The template parameter \tcode{T} of \tcode{shared_ptr} +may be an incomplete type. +\begin{note} +\tcode{T} may be a function type. +\end{note} \pnum \begin{example} @@ -12184,7 +12209,7 @@ \pnum \effects If \tcode{numeric_limits::max() / sizeof(Tp) < n}, -throws \tcode{length_error}. +throws \tcode{bad_array_new_length}. Otherwise equivalent to: \begin{codeblock} return static_cast(memory_rsrc->allocate(n * sizeof(Tp), alignof(Tp))); @@ -12256,7 +12281,7 @@ \begin{itemize} \item if \tcode{numeric_limits::max() / sizeof(T) < n}, - throws \tcode{length_error}, + throws \tcode{bad_array_new_length}, \item otherwise equivalent to: \begin{codeblock} @@ -13503,11 +13528,6 @@ template constexpr reference_wrapper ref(reference_wrapper) noexcept; template constexpr reference_wrapper cref(reference_wrapper) noexcept; - template struct unwrap_reference; - template using @\libglobal{unwrap_reference_t}@ = typename unwrap_reference::type; - template struct unwrap_ref_decay; - template using @\libglobal{unwrap_ref_decay_t}@ = typename unwrap_ref_decay::type; - // \ref{arithmetic.operations}, arithmetic operations template struct plus; template struct minus; @@ -14006,34 +14026,6 @@ \tcode{cref(t.get())}. \end{itemdescr} -\rSec3[refwrap.unwrapref]{Transformation type trait \tcode{unwrap_reference}} - -\indexlibraryglobal{unwrap_reference}% -\begin{itemdecl} -template - struct unwrap_reference; -\end{itemdecl} - -\begin{itemdescr} -\pnum -If \tcode{T} is -a specialization \tcode{reference_wrapper} for some type \tcode{X}, -the member typedef \tcode{type} of \tcode{unwrap_reference} is \tcode{X\&}, -otherwise it is \tcode{T}. -\end{itemdescr} - -\indexlibraryglobal{unwrap_ref_decay}% -\begin{itemdecl} -template - struct unwrap_ref_decay; -\end{itemdecl} - -\begin{itemdescr} -\pnum -The member typedef \tcode{type} of \tcode{unwrap_ref_decay} -denotes the type \tcode{unwrap_reference_t>}. -\end{itemdescr} - \rSec2[arithmetic.operations]{Arithmetic operations} \pnum @@ -15683,12 +15675,16 @@ \begin{itemdescr} \pnum -\remarks -This deduction guide participates in overload resolution only if -\tcode{\&F::operator()} is well-formed when treated as an unevaluated operand. -In that case, if \tcode{decltype(\&F::operator())} is of the form +\constraints +\tcode{\&F::operator()} is well-formed +when treated as an unevaluated operand and +\tcode{decltype(\brk{}\&F::operator())} is of the form \tcode{R(G::*)(A...)}~\cv{}~\tcode{\opt{\&}~\opt{noexcept}} -for a class type \tcode{G}, then the deduced type is \tcode{function}. +for a class type \tcode{G}. + +\pnum +\remarks +The deduced type is \tcode{function}. \pnum \begin{example} @@ -16423,8 +16419,6 @@ template struct has_unique_object_representations; - template struct has_strong_structural_equality; - // \ref{meta.unary.prop.query}, type property queries template struct alignment_of; template struct rank; @@ -16519,6 +16513,8 @@ template struct common_reference; template struct underlying_type; template struct invoke_result; + template struct unwrap_reference; + template struct unwrap_ref_decay; template using @\libglobal{type_identity_t}@ = typename type_identity::type; @@ -16542,6 +16538,10 @@ using @\libglobal{underlying_type_t}@ = typename underlying_type::type; template using @\libglobal{invoke_result_t}@ = typename invoke_result::type; + template + using unwrap_reference_t = typename unwrap_reference::type; + template + using unwrap_ref_decay_t = typename unwrap_ref_decay::type; template using @\libglobal{void_t}@ = void; @@ -16697,10 +16697,6 @@ inline constexpr bool has_unique_object_representations_v = has_unique_object_representations::value; - template - inline constexpr bool has_strong_structural_equality_v - = has_strong_structural_equality::value; - // \ref{meta.unary.prop.query}, type property queries template inline constexpr size_t @\libglobal{alignment_of_v}@ = alignment_of::value; @@ -17358,14 +17354,6 @@ \tcode{T} shall be a complete type, \cv{}~\tcode{void}, or an array of unknown bound. \\ \rowsep -\indexlibraryglobal{has_strong_structural_equality}% -\tcode{template}\br - \tcode{struct has_strong_structural_equality;} & - The type \tcode{T} has - strong structural equality\iref{class.compare.default}. & - \tcode{T} shall be a complete type, \cv{} \tcode{void}, or - an array of unknown bound. \\ \rowsep - \end{libreqtab3b} \pnum @@ -18083,7 +18071,21 @@ \br \requires{} \tcode{Fn} and all types in the template parameter pack \tcode{ArgTypes} shall be complete types, \cv{}~\tcode{void}, or arrays of - unknown bound.\\ + unknown bound.\\ \rowsep + +\indexlibraryglobal{unwrap_reference}% +\tcode{template} \tcode{struct unwrap_reference;} + & + If \tcode{T} is + a specialization \tcode{reference_wrapper} for some type \tcode{X}, + the member typedef \tcode{type} of \tcode{unwrap_reference} is \tcode{X\&}, + otherwise it is \tcode{T}. \\ \rowsep + +\indexlibraryglobal{unwrap_ref_decay}% +\tcode{template} \tcode{unwrap_ref_decay;} + & + The member typedef \tcode{type} of \tcode{unwrap_ref_decay} + denotes the type \tcode{unwrap_reference_t>}.\\ \end{libreqtab2a} \indexlibraryglobal{aligned_storage}% @@ -18101,6 +18103,16 @@ \end{codeblock} \end{note} +\pnum +In addition to being available via inclusion +of the \tcode{} header, the templates +\tcode{unwrap_reference}, +\tcode{unwrap_ref_decay}, +\tcode{unwrap_reference_t}, and +\tcode{unwrap_ref_decay_t} +are available +when the header \tcode{}\iref{functional.syn} is included. + \indexlibraryglobal{common_type}% \pnum Let: @@ -18179,10 +18191,6 @@ None of the following will apply if there is a specialization \tcode{common_type}. \end{note} - \item Otherwise, if both \tcode{D1} and \tcode{D2} denote - comparison category types\iref{cmp.categories.pre}, - let \tcode{C} denote the common comparison type\iref{class.spaceship} - of \tcode{D1} and \tcode{D2}. \item Otherwise, if \begin{codeblock} decay_t() : declval())> @@ -19214,6 +19222,11 @@ The type \tcode{chars_format} is a bitmask type\iref{bitmask.types} with elements \tcode{scientific}, \tcode{fixed}, and \tcode{hex}. +\pnum +The types \tcode{to_chars_result} and \tcode{from_chars_result} +have the data members and special members specified above. +They have no base classes or members other than those specified. + \rSec2[charconv.to.chars]{Primitive numeric output conversion} \pnum @@ -19537,15 +19550,17 @@ Out format_to(Out out, const locale& loc, wstring_view fmt, const Args&... args); template - Out vformat_to(Out out, string_view fmt, format_args_t args); + Out vformat_to(Out out, string_view fmt, + format_args_t, char> args); template - Out vformat_to(Out out, wstring_view fmt, format_args_t args); + Out vformat_to(Out out, wstring_view fmt, + format_args_t, wchar_t> args); template Out vformat_to(Out out, const locale& loc, string_view fmt, - format_args_t args); + format_args_t, char> args); template Out vformat_to(Out out, const locale& loc, wstring_view fmt, - format_args_t args); + format_args_t, wchar_t> args); template struct format_to_n_result { Out out; @@ -19617,6 +19632,11 @@ } \end{codeblock} + +\pnum +The class template \tcode{format_to_n_result} +has the template parameters, data members, and special members specified above. It has no base classes or members other than those specified. + \rSec2[format.string]{Format string} \rSec3[format.string.general]{In general} @@ -19628,7 +19648,8 @@ \newcommand{\fmtgrammarterm}[1]{\gterm{#1}} \pnum -A \defn{format string} is a (possibly empty) sequence of +A \defn{format string} for arguments \tcode{args} is +a (possibly empty) sequence of \defnx{replacement fields}{replacement field!format string}, \defnx{escape sequences}{escape sequence!format string}, and characters other than \tcode{\{} and \tcode{\}}. @@ -19686,10 +19707,12 @@ \pnum The \fmtgrammarterm{arg-id} field specifies the index of -% FIXME: "args" hasn't been introduced yet! the argument in \tcode{args} whose value is to be formatted and inserted into the output instead of the replacement field. +If there is no argument with +the index \fmtgrammarterm{arg-id} in \tcode{args}, +the string is not a format string for \tcode{args}. The optional \fmtgrammarterm{format-specifier} field explicitly specifies a format for the replacement value. @@ -19728,6 +19751,10 @@ that define how the value should be presented. Each type can define its own interpretation of the \fmtgrammarterm{format-spec} field. +If \fmtgrammarterm{format-spec} does not conform +to the format specifications for +the argument type referred to by \fmtgrammarterm{arg-id}, +the string is not a format string for \tcode{args}. \begin{example} \begin{itemize} \item @@ -19792,13 +19819,13 @@ \begin{ncbnf} \fmtnontermdef{width}\br positive-integer\br - \terminal{\{} arg-id \terminal{\}} + \terminal{\{} \opt{arg-id} \terminal{\}} \end{ncbnf} \begin{ncbnf} \fmtnontermdef{precision}\br \terminal{.} nonnegative-integer\br - \terminal{.} \terminal{\{} arg-id \terminal{\}} + \terminal{.} \terminal{\{} \opt{arg-id} \terminal{\}} \end{ncbnf} \begin{ncbnf} @@ -19819,6 +19846,7 @@ \end{note} \pnum +The \fmtgrammarterm{align} specifier applies to all argument types. The meaning of the various alignment options is as specified in \tref{format.align}. \begin{example} \begin{codeblock} @@ -19877,16 +19905,24 @@ \tcode{+} & Indicates that a sign should be used for both non-negative and negative numbers. +The \tcode{+} sign is inserted before the output of \tcode{to_chars} for +non-negative numbers other than negative zero. +\begin{note} +For negative numbers and negative zero +the output of \tcode{to_chars} will already contain the sign +so no additional transformation is performed. +\end{note} \\ \rowsep % \tcode{-} & -Indicates that a sign should be used only for negative numbers (this is -the default behavior). +Indicates that a sign should be used for +negative numbers and negative zero only (this is the default behavior). \\ \rowsep % space & -Indicates that a leading space should be used for non-negative numbers, and -a minus sign for negative numbers. +Indicates that a leading space should be used for +non-negative numbers other than negative zero, and +a minus sign for negative numbers and negative zero. \\ \end{floattable} @@ -19908,15 +19944,16 @@ % FIXME: This is not a definition. \defnx{alternate form}{alternate form!format string} to be used for the conversion. -This option is only valid for arithmetic types other than +This option is valid for arithmetic types other than \tcode{charT} and \tcode{bool} -or when an integer presentation type is specified. +or when an integer presentation type is specified, and not otherwise. For integral types, -the alternate form adds the +the alternate form inserts the base prefix (if any) specified in \tref{format.type.int} -to the output value. +into the output after the sign character (possibly space) if there is one, or +before the output of \tcode{to_chars} otherwise. For floating-point types, -the alternate form causes the result of the conversion +the alternate form causes the result of the conversion of finite values to always contain a decimal-point character, even if no digits follow it. % FIXME: This is a weird place for this part of the spec to appear. @@ -19927,6 +19964,16 @@ % alter its behavior? trailing zeros are not removed from the result. +\pnum +If \tcode{\{ \opt{\fmtgrammarterm{arg-id}} \}} is used in +a \fmtgrammarterm{width} or \fmtgrammarterm{precision}, +the value of the corresponding formatting argument is used in its place. +If the corresponding formatting argument is not of integral type, or +its value is +negative for \fmtgrammarterm{precision} or +non-positive for \fmtgrammarterm{width}, +an exception of type \tcode{format_error} is thrown. + \pnum % FIXME: What if it's an arg-id? The \fmtgrammarterm{positive-integer} in @@ -20221,6 +20268,17 @@ \\ \end{floattable} +\rSec2[format.err.report]{Error reporting} + +\pnum +Formatting functions throw \tcode{format_error} if +an argument \tcode{fmt} is passed that +is not a format string for \tcode{args}. +They propagate exceptions thrown by operations of +\tcode{formatter} specializations and iterators. +Failure to allocate storage is reported by +throwing an exception as described in~\ref{res.on.exception.handling}. + \rSec2[format.functions]{Formatting functions} \pnum @@ -20307,7 +20365,7 @@ \pnum \throws -\tcode{format_error} if \tcode{fmt} is not a format string. +As specified in~\ref{format.err.report}. \end{itemdescr} \indexlibraryglobal{format_to}% @@ -20324,7 +20382,7 @@ Equivalent to: \begin{codeblock} using context = basic_format_context; -return vformat_to(out, fmt, {make_format_args(args...)}); +return vformat_to(out, fmt, make_format_args(args...)); \end{codeblock} \end{itemdescr} @@ -20342,22 +20400,24 @@ Equivalent to: \begin{codeblock} using context = basic_format_context; -return vformat_to(out, loc, fmt, {make_format_args(args...)}); +return vformat_to(out, loc, fmt, make_format_args(args...)); \end{codeblock} \end{itemdescr} \indexlibraryglobal{vformat_to}% \begin{itemdecl} template - Out vformat_to(Out out, string_view fmt, format_args_t args); + Out vformat_to(Out out, string_view fmt, + format_args_t, char> args); template - Out vformat_to(Out out, wstring_view fmt, format_args_t args); + Out vformat_to(Out out, wstring_view fmt, + format_args_t, wchar_t> args); template Out vformat_to(Out out, const locale& loc, string_view fmt, - format_args_t args); + format_args_t, char> args); template Out vformat_to(Out out, const locale& loc, wstring_view fmt, - format_args_t args); + format_args_t, wchar_t> args); \end{itemdecl} \begin{itemdescr} @@ -20389,7 +20449,7 @@ \pnum \throws -\tcode{format_error} if \tcode{fmt} is not a format string. +As specified in~\ref{format.err.report}. \end{itemdescr} \indexlibraryglobal{format_to_n}% @@ -20446,7 +20506,7 @@ \pnum \throws -\tcode{format_error} if \tcode{fmt} is not a format string. +As specified in~\ref{format.err.report}. \end{itemdescr} \indexlibraryglobal{formatted_size}% @@ -20480,7 +20540,7 @@ \pnum \throws -\tcode{format_error} if \tcode{fmt} is not a format string. +As specified in~\ref{format.err.report}. \end{itemdescr} \rSec2[format.formatter]{Formatter} @@ -21025,14 +21085,6 @@ template explicit basic_format_arg(const T* p) noexcept; // \expos - template - friend auto visit_format_arg(Visitor&& vis, - basic_format_arg arg); // \expos - - template - friend @\placeholder{format-arg-store}@ - make_format_args(const Args&... args); // \expos - public: basic_format_arg() noexcept;