|
Boost : |
Subject: Re: [boost] [EXTERNAL] New algorithm in Boost.Algorithm: "gather" -- looking for comments
From: Andrey Semashev (andrey.semashev_at_[hidden])
Date: 2013-01-23 01:27:14
On Wed, Jan 23, 2013 at 9:12 AM, Belcourt, Kenneth <kbelco_at_[hidden]> wrote:
> Hi Marshall,
>
> On Jan 21, 2013, at 5:49 PM, Marshall Clow wrote:
>
>> I have committed a new algorithm named "gather" into Boost.Algorithm.
>
> Are scatter and assemble algorithms also forthcoming?
>
>> gather() takes a collection of elements defined by a pair of iterators and moves the ones satisfying a predicate to them to a position (called the pivot) within the sequence. The algorithm is stable. The result is a pair of iterators that contains the items that satisfy the predicate.
>
> This is a good start, but I'd like to see gather generalized. One change is to lift the requirement for the pivot being internal to the element sequence as in many computational engineering applications we don't want to destroy the source elements when we perform the gather, we want to gather (some parts of) the elements into another buffer.
Isn't it the same as copy_if?
Also, std::remove looks similar to gather when the gathered elements
are put to the end of the sequence.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk