Created on 2017-07-07.00:00:00 last changed 45 months ago
Proposed resolution:
This wording is relative to N4659.
Edit [list.ops] as indicated:
-1- Since lists allow fast insertion and erasing from the middle of a list, certain operations are provided specifically for them.259) In this subclause, arguments for a template parameter named Predicate or BinaryPredicate shall meet the corresponding requirements in [algorithms.requirements]. For merge and sort, the definitions and requirements in [alg.sorting] apply.
Edit [list.ops] as indicated:
void merge(list& x); void merge(list&& x); template <class Compare> void merge(list& x, Compare comp); template <class Compare> void merge(list&& x, Compare comp);-22- Requires:
comp shall define a strict weak ordering ([alg.sorting]), and bBoth the list and the argument list shall be sortedaccording to this orderingwith respect to the comparator operator< (for the first two overloads) or comp (for the last two overloads).
Delete [list.ops]/28 as redundant:
void sort(); template <class Compare> void sort(Compare comp);
-28- Requires: operator< (for the first version) or comp (for the second version) shall define a strict weak ordering ([alg.sorting]).
Insert a new paragraph at the beginning of [forwardlist.ops]:
-?- In this subclause, arguments for a template parameter named Predicate or BinaryPredicate shall meet the corresponding requirements in [algorithms.requirements]. For merge and sort, the definitions and requirements in [alg.sorting] apply.
void splice_after(const_iterator position, forward_list& x); void splice_after(const_iterator position, forward_list&& x);[…]
Edit [forwardlist.ops] as indicated:
void merge(forward_list& x); void merge(forward_list&& x); template <class Compare> void merge(forward_list& x, Compare comp); template <class Compare> void merge(forward_list&& x, Compare comp);-22- Requires:
comp defines a strict weak ordering ([alg.sorting]), and*this and x are both sortedaccording to this orderingwith respect to the comparator operator< (for the first two overloads) or comp (for the last two overloads). get_allocator() == x.get_allocator().
Delete [forwardlist.ops]/23 as redundant:
void sort(); template <class Compare> void sort(Compare comp);
-23- Requires: operator< (for the version with no arguments) or comp (for the version with a comparison argument) defines a strict weak ordering ([alg.sorting]).
[ 2017-07 Toronto Tuesday PM issue prioritization ]
Priority 0; status to Ready
Some specialized algorithms for forward_list and list take template parameters named Predicate, BinaryPredicate, or Compare. However, there's no wording importing the full requirements for template type parameters with such names from [algorithms.requirements] and [alg.sorting], which means, for instance, that there appears to be no rule prohibiting Compare from modifying its arguments, because we only refer to [alg.sorting] for the definition of strict weak ordering. Is that intended?
History | |||
---|---|---|---|
Date | User | Action | Args |
2021-02-25 10:48:01 | admin | set | status: wp -> c++20 |
2017-11-13 19:01:36 | admin | set | status: voting -> wp |
2017-10-17 18:34:55 | admin | set | status: ready -> voting |
2017-07-12 01:58:24 | admin | set | messages: + msg9361 |
2017-07-12 01:58:24 | admin | set | status: new -> ready |
2017-07-08 14:21:32 | admin | set | messages: + msg9328 |
2017-07-07 00:00:00 | admin | create |