This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Resolved status.
is_partitioned
requirements need updatingSection: 26.8.5 [alg.partitions] Status: Resolved Submitter: Jonathan Wakely Opened: 2016-07-06 Last modified: 2020-05-12
Priority: 3
View all other issues in [alg.partitions].
View all issues with Resolved status.
Discussion:
Requires:
InputIterator
's value type shall be convertible toPredicate
's argument type.
This seems to date from the days of adaptable function objects with an argument_type
typedef, but in
modern C++ the predicate might not have an argument type. It could have a function template that accepts various
arguments, so it doesn't make sense to state requirements in terms of a type that isn't well defined.
[2016-07, Toronto Saturday afternoon issues processing]
The proposed resolution needs to be updated because the underlying wording has changed. Also, since the sequence is homogeneous, we shouldn't have to say that the expression is well-formed for all elements in the range; that implies that it need not be well-formed if the range is empty.
Marshall and JW to reword. Status to Open
Previous resolution [SUPERSEDED]:
This wording is relative to N4594.
Edit 26.8.5 [alg.partitions] as indicated:
template <class InputIterator, class Predicate> bool is_partitioned(InputIterator first, InputIterator last, Predicate pred);-1- Requires:
[…]The expressionInputIterator
's value type shall be convertible toPredicate
's argument typepred(*i)
shall be well-formed for alli
in[first, last)
.template <class InputIterator, class OutputIterator1, class OutputIterator2, class Predicate> pair<OutputIterator1, OutputIterator2> partition_copy(InputIterator first, InputIterator last, OutputIterator1 out_true, OutputIterator2 out_false, Predicate pred);-12- Requires:
[…]InputIterator
's value type shall beCopyAssignable
, and shall be writable (24.3.1 [iterator.requirements.general]) to theout_true
andout_false
OutputIterator
s, andshall be convertible tothe expressionPredicate
's argument typepred(*i)
shall be well-formed for alli
in[first, last)
. The input range shall not overlap with either of the output ranges.template<class ForwardIterator, class Predicate> ForwardIterator partition_point(ForwardIterator first, ForwardIterator last, Predicate pred);-16- Requires:
[…]The expressionForwardIterator
's value type shall be convertible toPredicate
's argument typepred(*i)
shall be well-formed for alli
in[first, last)
.[first, last)
shall be partitioned bypred
, i.e. all elements that satisfypred
shall appear before those that do not.
[2019-03-17; Daniel comments and removes previous wording]
In the recent working draft N4810 all the "shall be convertible to Predicate
's
argument type" are gone - they were cleaned up when "The One Range" proposal P0896R4
had been accepted in San Diego 2018.
pred(*i)
is well-formed), because this follows (in a more general way) by the expression
invoke(pred, invoke(proj, e))
that is applied to the elements e
of [first, last)
.
Therefore I'm suggesting that the resolution for this issue should be: Resolved by P0896R4.
[2020-05-12; Reflector discussions]
Resolved by P0896R4.
Rationale:
Resolved by P0896R4.Proposed resolution: