Boost logo

Boost :

Subject: Re: [boost] Boost.Algorithm design question
From: Peter Dimov (pdimov_at_[hidden])
Date: 2011-10-29 10:43:38


Dave Abrahams wrote:

> Here's another reason why the first formulation might not be such a hot
> idea: it rules out some obvious implementations that really ought to be
> OK. For example,
>
> template <class InputIterator, class T>
> InputIterator find(InputIterator i, InputIterator j, T value)
> {
> while (i != j && !(*i == value))
> ++i;
> return i;
> }

Yes, but this formulation doesn't need *i and value to be of the same type
or operator== to be an equivalence relation. It just needs operator== to
return something bool-ish. I've no problem with this requirement.


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