Boost logo

Boost :

Subject: Re: [boost] Boost.Algorithm design question
From: Dave Abrahams (dave_at_[hidden])
Date: 2011-10-06 11:30:32


on Thu Oct 06 2011, lcaminiti <lorcaminiti-AT-gmail.com> wrote:

>From the standard:
>
> // 25.2, non-modifying sequence operations:
> template <class InputIterator, class Predicate>
> bool none_of(InputIterator first, InputIterator last, Predicate pred);
> template<class InputIterator, class T>
> InputIterator find(InputIterator first, InputIterator last, const T& value);
>
> Given that I am used to how the STL works, at first I'd expect
> Boost.Algorithm to follow the same interface where it makes sense-- why
> would none_of_equal use an interface different from std::find? Now, if truly
> the STL interface is incorrect and Boost.Algorithm needs to use
> iterator_traits::value, wouldn't it make sense to also change the STL
> interface in the C++ standard?

Yes, it would make sense. No, we won't do it, because it would break
code.

> I think what I am trying to ask is: Does anyone know why std::find does not
> use use iterator_traits::value?

IIUC it was an oversight, and IIRC Stepanov's later work (EOP) does
restrict the type of "value".

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

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