Boost logo

Boost :

Subject: Re: [boost] [Range] contains() for unsorted ranges?
From: Vee Kay (vkicefire_at_[hidden])
Date: 2014-04-10 16:15:20


On 08/04/14 14:24, Neil Groves wrote:
> I would like to point out that you can already do this quite nearly
> like this: boost::find<boost::return_found_end>(rng, x) since the
> iterator_range will convert to bool.

Thanks for pointing out this idiom.

Meanwhile, I have discovered that Boost.Algorithm's any_of and any_of_equal:

http://www.boost.org/doc/libs/1_55_0/libs/algorithm/doc/html/the_boost_algorithm_library/CXX11/any_of.html

work with ranges out of the box, eliminating the need to use find or
find_if for this purpose.
Note also that there is also a contains() to test whether a range is
contained, buried in <boost/algorithm/string/predicate.hpp>.
Perhaps these should be presented in the documentation instead?

Albert


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