Boost logo

Boost :

Subject: Re: [boost] New algorithm in Boost.Algorithm: "gather" -- looking for comments
From: Marshall Clow (mclow.lists_at_[hidden])
Date: 2013-01-26 23:04:42


On Jan 26, 2013, at 2:53 PM, Rob Stewart <robertstewart_at_[hidden]> wrote:

>> Post-condition: The position
>
> The specified position
>
>> is within the returned range.

Almost:

If the input is int arr [] = { 1, 2, 3, 4, 5, 7, 9, 11, 13, 15 }
and you call
        gather ( arr, arr + 10, arr + 4, IsEven )

then the output will be:
        { 1, 3, 2, 4, 5, 7, 9, 11, 13, 15 }
and the returned pair will be { arr + 2, arr + 4 }

If you add the precondition of pred(*pivot), then, yes, pivot will always be in the returned range.

If you don't want to require pred(*pivot), then it might be that the returned range will have pivot as it's "end". (pair.second == pivot) in the case where none(pivot, last, pred) is true.

-- Marshall

Marshall Clow Idio Software <mailto:mclow.lists_at_[hidden]>

A.D. 1517: Martin Luther nails his 95 Theses to the church door and is promptly moderated down to (-1, Flamebait).
        -- Yu Suzuki


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk