Commit 6c241778 by Jonathan Wakely Committed by Jonathan Wakely

Optimize std::advance for single increments

	* include/bits/stl_iterator_base_funcs.h
	(__advance<_RandomAccessIterator, _Distance>): Optimize for next/prev
	cases where incrementing or decrementing a single step.

From-SVN: r248875
parent d08606ce
2017-06-05 Jonathan Wakely <jwakely@redhat.com>
* include/bits/stl_iterator_base_funcs.h
(__advance<_RandomAccessIterator, _Distance>): Optimize for next/prev
cases where incrementing or decrementing a single step.
* include/bits/shared_ptr_base.h (__shared_ptr::owner_before)
(__weak_ptr::owner_before, _Sp_owner_less::operator()): Add noexcept
specifiers as per LWG 2873 and LWG 2942.
......
......@@ -177,7 +177,12 @@ _GLIBCXX_BEGIN_NAMESPACE_VERSION
// concept requirements
__glibcxx_function_requires(_RandomAccessIteratorConcept<
_RandomAccessIterator>)
__i += __n;
if (__builtin_constant_p(__n) && __n == 1)
++__i;
else if (__builtin_constant_p(__n) && __n == -1)
--__i;
else
__i += __n;
}
/**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment