N3795: A more common version of algorithm std::partition_copy -- Vladimir Grigoriev

A new WG21 paper is available. A copy is linked below, and the paper will also appear in the next normal WG21 mailing. If you are not a committee member, please use the comments section below or the std-proposals forum for public discussion.

Document number: N3795

Date: 2013-09-16

A more common version of algorithm std::partition_copy

by Vladimir Grigoriev


The existent version of algorithm std::partition_copy has limited capabilities. In fact this algorithm is similar to algorithm std::copy but instead of copying all elements of the source sequence in one destination sequence it redirects all elements of the source sequence in either of two destination sequences depending on the given predicate. As in the first case in the second case all elements of the source sequence are processed.

However sometimes there is a need to process only that elements of the source sequence that satisfy some criteria. To demonstrate the idea let consider a simple task to copy all positive elements of an integral array in one container and all negative elements of the same array in some other container without touching elements equal to zero. ...

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.