1. Changelog
-
R0
-
First submission
-
2. Motivation and scope
In the Tokyo 2024 meeting [P2248R8] (Enabling list-initialization for algorithms) was adopted.
Due to an oversight, the
family of algorithms was
excluded from the ones where a defaulted template parameter was added.
We propose to modify
’s specification, so that it matches
the post-P2248 one for the rest of the algorithms (especially
).
3. Proposed Wording
All the proposed changes are relative to [N5008].
In [version.syn], bump the feature-test macro as shown:
#define __cpp_lib_algorithm_default_value_type 202403L YYYYMML // also in <algorithm>, <ranges>, <string>, <deque>, <list>, <forward_list>, <vector> , <memory>
where the new value corresponds to the year and month of adoption of the present proposal.
Modify [memory.syn] and the corresponding signatures in the entries under [uninitialized.fill] as shown:
template < class NoThrowForwardIterator , class T = typename std :: iterator_traits < NoThrowForwardIterator >:: value_type > constexpr void uninitialized_fill ( NoThrowForwardIterator first , // freestanding NoThrowForwardIterator last , const T & x ); template < class ExecutionPolicy , class NoThrowForwardIterator , class T = typename std :: iterator_traits < NoThrowForwardIterator >:: value_type > void uninitialized_fill ( ExecutionPolicy && exec , // freestanding-deleted, NoThrowForwardIterator first , // see [algorithms.parallel.overloads] NoThrowForwardIterator last , const T & x ); template < class NoThrowForwardIterator , class Size , class T = typename std :: iterator_traits < NoThrowForwardIterator >:: value_type > constexpr NoThrowForwardIterator uninitialized_fill_n ( NoThrowForwardIterator first , Size n , const T & x ); // freestanding template < class ExecutionPolicy , class NoThrowForwardIterator , class Size , class T = typename std :: iterator_traits < NoThrowForwardIterator >:: value_type > NoThrowForwardIterator uninitialized_fill_n ( ExecutionPolicy && exec , // freestanding-deleted, NoThrowForwardIterator first , // see [algorithms.parallel.overloads] Size n , const T & x ); namespace ranges { template < nothrow - forward - iterator I , nothrow - sentinel - for < I > S , class T = iter_value_t < I > > requires constructible_from < iter_value_t < I > , const T &> constexpr I uninitialized_fill ( I first , S last , const T & x ); // freestanding template < nothrow - forward - range R , class T = range_value_t < R > > requires constructible_from < range_value_t < R > , const T &> constexpr borrowed_iterator_t < R > uninitialized_fill ( R && r , const T & x ); // freestanding template < nothrow - forward - iterator I , class T = iter_value_t < I > > requires constructible_from < iter_value_t < I > , const T &> constexpr I uninitialized_fill_n ( I first , // freestanding iter_difference_t < I > n , const T & x ); }
4. Acknowledgements
Thanks to Ruslan Arutyunyan for spotting this oversight.
Thanks to KDAB for supporting this work.
All remaining errors are ours and ours only.