Boost logo

Boost :

Subject: Re: [boost] [algorithm] adjacent_for_each interest?
From: Dave Abrahams (dave_at_[hidden])
Date: 2013-02-10 18:25:32


on Sun Feb 10 2013, Ian Hobson <ian.r.hobson-AT-gmail.com> wrote:

> On 10 Feb 2013, at 16:29, Evgeny Panasyuk <evgeny.panasyuk_at_[hidden]> wrote:
>
>> 10.02.2013 17:10, Ian Hobson:
>>
>>> Initial implementation available at http://github.com/irh/adjacent_for_each
>>
>> I have just noticed that you use:
>>
>> for (InputIterator next = first + 1; next != last; first++, next++)
>>
>> "first + 1" is legal only for RandomAccessIterator. You should test
>> your algorithm on real InputIterator.
>
> Thanks. I've updated the implementation to correct this, and to
> document that it's suitable for ForwardIterators. I'll look in to
> adding support for InputIterators.

FYI: this is why boost::next(first) was created.

-- 
Dave Abrahams

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