|
Boost : |
Subject: Re: [boost] Formal Review: Boost.RangeEx
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2009-02-25 13:39:01
Giovanni Piero Deretta skrev:
> On Wed, Feb 25, 2009 at 7:04 PM, Thorsten Ottosen
> <thorsten.ottosen_at_[hidden]> wrote:
>> What about something like
>>
>> total = r | filter(f) | map(m) -> accumulate(zero, a);
>>
>
> how would you make this work (leaving the framework extensible to new
> algorithm)? Maybe you meant ->*.
>
>> or
>>
>> total = r | filter(f) | map(m) >> accumulate(zero, a);
>>
>
> I sort of like the >> syntax (btw, I think that there are functional
> languages that use the same syntax for function chaining), but I do
> not see the necessity of distinguishing between '|' and '>>'. Just use
> one.
Well, since there is a semantical difference, and a large one, I'm
leaning towards that we should use two operators.
Especially is we will have both adaptor::transform and transform as an
algorithm.
>> ?
>>
>> The is a problem when we just want to apply several algorithms:
>>
>> boost::erase( cont, boost::unique( boost::sort(cont) ) );
>>
>
> I woudn't put many inplace algorithm in the same expression nor
> encourage users to do it. The unique->erase idiom is common, on the
> other hand sort has little reason being in that expression.
Unique won't work properly if you don'e have a sorted sequence, AFAIR
-Thorsten
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk