
on Mon Feb 11 2013, Evgeny Panasyuk <evgeny.panasyuk-AT-gmail.com> wrote:
11.02.2013 3:09, Dave Abrahams:
In this regard your version at https://github.com/irh/adjacent_for_each/blob/master/boost/algorithm/adjacen... is broken. Because it advertises to work on InputIterator, but it dereferences iterator at same position several times. As the result current implementation is for ForwardIterator.
That's incorrect. The mental model for InputIterator is an ephemeral input stream *with a one-element backing buffer*. You are allowed to dereference the same InputIterator multiple times at the same position until that iterator or a copy of it is incremented.
Thanks for correction, I should re-phrase my sentence as: "but it dereferences iterator at same position several times *after passing to next and/or dereferencing it*" ( https://github.com/irh/adjacent_for_each/blob/382070171df195afb945f86db442a8... )
OK, but the last part of that sentence remains irrelevant. It should end with the word "next." -- Dave Abrahams