This page is a snapshot from the LWG issues list, see the Library Active Issues List for more information and the meaning of C++14 status.

2357. Remaining "Assignable" requirement

Section: 27.8.5 [alg.partitions] Status: C++14 Submitter: Daniel Krügler Opened: 2014-02-01 Last modified: 2017-07-05

Priority: 0

View all other issues in [alg.partitions].

View all issues with C++14 status.

Discussion:

The Requires element of partition_copy says (emphasis mine):

Requires: InputIterator's value type shall be Assignable, and …

The C++03 term Assignable was replaced by CopyAssignable, remaining cleanups happened via LWG issue 972, but algorithm partition_copy was not affected at that time (during that time the requirements of partition_copy didn't mention writable nor assignable, but I cannot track down at the moment where these requirements had been added). Presumably this requirement should be corrected similarly to the approach used in 972.

Another question is whether a CopyAssignable is needed here, given the fact that we already require "writable to" an OutputIterator which is defined in 25.3.1 [iterator.requirements.general] and does already impose the necessary statement

*out = *in;

Given the fact that partition_copy never touches any input value twice, there is no reason why anything more than writable to should be necessary.

The below suggested primary resolution does not respond to the second part of this question.

[Issaquah 2014-02-11: Move to Immediate]

Proposed resolution:

This wording is relative to N3797.

  1. Modify 27.8.5 [alg.partitions], p12 as indicated:

    -12- Requires: InputIterator's value type shall be CopyAssignable, and shall be writable to the out_true and out_false OutputIterators, and shall be convertible to Predicate's argument type. The input range shall not overlap with either of the output ranges.