Boost logo

Boost :

Subject: Re: [boost] Boost.Algorithm design question
From: Vicente Botet (vicente.botet_at_[hidden])
Date: 2011-10-06 07:29:58


Marshall Clow-2 wrote:
>
> So, what do people prefer (and why?):
>
> template<typename InputIterator, typename V>
> bool none_of_equal ( InputIterator first, InputIterator last, V const &val
> )
> {
> for ( ; first != last; ++first )
> if ( val == *first )
> return false;
> return true;
> }
>
> or
>
> template<typename InputIterator, >
> bool none_of_equal ( InputIterator first, InputIterator last,
> iterator_traits<InputIterator>::value_type const &val )
> {
> for ( ; first != last; ++first )
> if ( val == *first )
> return false;
> return true;
> }
>
> In the first case, I think there's (possible) conversion from V to
> iterator_traits<InputIterator>::value_type each time through the loop.
> In the second case, there is not.
>
>

Couldn't you provide both using SFINAE?

Best,
Vicente

--
View this message in context: http://boost.2283326.n4.nabble.com/Boost-Algorithm-design-question-tp3876424p3877812.html
Sent from the Boost - Dev mailing list archive at Nabble.com.

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