This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of Immediate status.
Section: 26.8.5 [alg.partitions] Status: Immediate Submitter: Ruslan Arutyunyan Opened: 2025-11-07 Last modified: 2025-11-08
Priority: Not Prioritized
View all other issues in [alg.partitions].
View all issues with Immediate status.
Discussion:
Addresses US 162-261In 26.8.5 [alg.partitions] p21 the wording is unclear what happens if there is no such element. The proposed resolution tries to clarify that without complicating the wording. If the proposed resolution (or something along those lines) fails, the recommendation is to reject US 162-261.
[Kona 2025-11-07; approved by LWG. Status changed: New → Immediate.]
Proposed resolution:
This wording is relative to N5014.
Modify 26.8.5 [alg.partitions], as indicated:
template<class InputIterator, class OutputIterator1, class OutputIterator2, class Predicate> constexpr pair<OutputIterator1, OutputIterator2> partition_copy(InputIterator first, InputIterator last, OutputIterator1 out_true, OutputIterator2 out_false, Predicate pred); […] template<execution-policy Ep, sized-random-access-range R, sized-random-access-range OutR1, sized-random-access-range OutR2, class Proj = identity, indirect_unary_predicate<projected<iterator_t<R>, Proj>> Pred> requires indirectly_copyable<iterator_t<R>, iterator_t<OutR1>> && indirectly_copyable<iterator_t<R>, iterator_t<OutR2>> ranges::partition_copy_result<borrowed_iterator_t<R>, borrowed_iterator_t<OutR1>, borrowed_iterator_t<OutR2>> ranges::partition_copy(Ep&& exec, R&& r, OutR1&& out_true_r, OutR2&& out_false_r, Pred pred, Proj proj = {});-14- Let
[…] -19- Preconditions: The input range and output ranges do not overlap. […] -20- Effects: For each iteratorprojbeidentity{}for the overloads with no parameter namedprojand letE(x)bebool(invoke(pred, invoke(proj, x))).iin[first, first + N), copies*ito the output range[out_true, last_true)ifE(*i)istrue, or to the output range[out_false, last_false)otherwise. -21- Returns: Leto1Qbe theiterator past the lastnumber of elements copiedelementinto the output range[out_true, last_true), ando2Vbe theiterator past the lastnumber of elements copiedelementinto the output range[out_false, last_false). Returns:
- (21.1) —
{for the overloads in namespaceo1out_true + Q,o2out_false + V}std.- (21.2) —
{first + N,for the overloads in namespaceo1out_true + Q,o2out_false + V}ranges.-22- Complexity: At
most last - firstapplications ofpredandproj.