On Mon, 5 Jun 2017, Jonathan Wakely wrote:
LWG 2931 suggests a new overload of std::next for the default n==1
case, because it can be simpler for some random access iterators to do
++i than i += 1, e.g. for std::deque::iterator.
I've suggested we close that issue as NAD, because we don't need a new
overload to do that, and here's the proof. This performs the same
optimisation when the argument to __advance<RandomAccessIterator> is
known at compile-time to be +1 or -1, as is the case when called from
std::next(i) or std::prev(i).
Do you want to optimize the case __n == 0 as well? ;-)
--
Marc Glisse