Boost logo

Boost :

Subject: Re: [boost] Boost.RangeEx: contains?
From: Robert Jones (robertgbjones_at_[hidden])
Date: 2009-02-23 07:15:33


On Mon, Feb 23, 2009 at 11:45 AM, Eric Niebler <eric_at_[hidden]>wrote:

> Thorsten Ottosen wrote:
>
>> Eric Niebler skrev:
>>
>>> Mathias Gaunard wrote:
>>>
>>>> Marcus Lindblom wrote:
>>>>
>>>> I'm just missing basic "contains/contains_if" function, that searches
>>>>> and retursn a bool on whether an item is in a range. (i.e. find(rng, v) !=
>>>>> end(rng) ). I've found those are quite useful. Perhaps this just has another
>>>>> name and I overlooked it?
>>>>>
>>>>
>>>> What about !empty(rng | filtered(_1 == v)).
>>>>
>>>
>>> Sure, and most algorithms can be implemented in terms of fold.
>>>
>>
>> Can you enlight us about what the fold algorithm is?
>>
>
> Sorry, std::accumulate.
>

Eric,

I'm sorry if I'm being a bit slow here, but I've lost the thread somewhat!

"...most algorithms can be implemented in terms of fold.",
"...what is the fold algorithm?".
"...std::accumulate."

So most algorithms can be implemented in terms of std::accumulate?

Have I understood that right?

If so I think I can see your point, but surely empty() in terms of std::
accumulate
would be a bit obtuse?

Thanks, Rob.


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