Boost logo

Boost :

Subject: Re: [boost] [Algorithm] contains(v, 1)
From: mike.dev_at_[hidden]
Date: 2018-06-02 19:54:30


> -----Original Message-----
> From: Boost <boost-bounces_at_[hidden]> On Behalf Of Robert Ramey
> via Boost
> Sent: Saturday, June 2, 2018 9:36 PM
>
> [...]
>
> template<class F, class C>
> auto range_adaptor(const C & c){
> return F(c.begin(), c.end());
> }
>
> so one could say
>
> vector<int> v = ...
>
> range_adapt(std::find, v);
>
> for any collection type.
>

You know that this doesn't compile, because std::find is a function template right?
(and you are also missing some parts in your function signature, but that’s just a minor detail)

Most likely the standard library will finally get a

std::find(range, value)

but that doesn't help with the "problem" that there doesn't exist an algorithm
"contains"/"includes" that searches only for a single element.

> Robert Ramey
>

Mike


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