Boost logo

Boost :

Subject: Re: [boost] Formal Review: Boost.RangeEx
From: Giovanni Piero Deretta (gpderetta_at_[hidden])
Date: 2009-02-25 13:00:46


On Wed, Feb 25, 2009 at 6:51 PM, Thorsten Ottosen
<thorsten.ottosen_at_[hidden]> wrote:
> Neil Groves skrev:
>>
>> Dear Giovanni,
>
>>
>>>> I had considered
>>>> creating a range adaptor to be highly different to applying an
>>>> algorithm,
>>>> perhaps I over-emphasised this distinction when making the decision.
>>>
>>> FWIW, I have code like this:
>>>
>>> total = ( r | filter(_r, f) | map(_r, m) | accumulate(_r, zero, a)  );
>>>
>>> i.e. I don't have a strong distinction between adaptor and algorithms.
>>>
>>
>> Yes, I'm sold!
>
> Hm. What is the utility of _r above?
>

Its a placeholder. If filter(range, f) returns a filtered iterator
range, filter(_r, f) returns an unary function object from ranges to
filtered iterator ranges. _r It is the more or less the equivalent of
_1 in 'bind(filter, _1, f)'.

-- 
gpd

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