Boost logo

Boost :

Subject: Re: [boost] Boost.Algorithm design question
From: Dave Abrahams (dave_at_[hidden])
Date: 2011-10-06 15:54:57

on Thu Oct 06 2011, Marshall Clow <> wrote:

>> template< typename Iter >
>> requires
>> InputIterator<Iter>,
>> EqualityComparable<iterator_traits<Iter>::value_type>
>> bool none_of_equal ( Iter first, Iter last,
>> iterator_traits<Iter>::value_type const& value ) ; // option 2
> I think you're missing the requirement is that the value passed in be
> convertible to "iterator_traits<Iter>::value_type", since that is what
> will happen at the call site.

No! <sorry, I'm getting excited>

If I write a function that takes an int, do I have to specify that you
can pass "anything convertible to an int?" No! The same applies f when
you write a function that takes a reference to the iterator's
value_type. The function signature clearly says what is happening.

The fact that a conversion can happen is not the algorithm author's
problem when written this way.

Dave Abrahams
BoostPro Computing

Boost list run by bdawes at, gregod at, cpdaniel at, john at