
On Mon, Feb 23, 2009 at 6:54 PM, Mathias Gaunard <mathias.gaunard@ens-lyon.org> wrote:
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);
If I understand the documentation correctly, you can do boost::find<boost::return_found_end>(rng | filtered(pred)) to get exactly what you want. I find this very useful, but the syntax is a bit verbose. Also, a 'base' adaptor that removes a level of adaptation (i.e. the base_type from a boost::iterator adaptor) would be very useful. BTW, I hope to find the time to write a review myself. -- gpd