Boost logo

Boost :

Subject: Re: [boost] Boost.RangeEx: contains?
From: Mathias Gaunard (mathias.gaunard_at_[hidden])
Date: 2009-02-23 12:54:12


Eric Niebler wrote:

> And that's my point exactly. I feel that this:
>
> boost::find( rng | filtered(pred) )
>
> is more obscure than this:
>
> boost::find_if( rng, pred );
>
> Not only that, but I presume their return types are different, too. The
> first would return filtered iterators, the second the original
> iterators. Isn't that right?

Indeed.

Which is why I suggested that boost::find return a [it, end[ range,
rather than just the `it' iterator.

That way you can do

boost::empty(boost::find(rng | filtered(pred)));

instead of

auto rng2 = rng | filtered(pred);
boost::find(rng2) != boost::end(rng2);


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