On 28/06/16 21:59 +0200, François Dumont wrote:
@@ -303,16 +301,20 @@ _GLIBCXX_BEGIN_NAMESPACE_CONTAINER emplace(const_iterator __position, _Args&&... __args) { const size_type __n = __position - begin();
It looks like this should use __position - cbegin(), to avoid an implicit conversion from iterator to const_iterator, and ...
- if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage - && __position == end()) - { - _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish, - std::forward<_Args>(__args)...); - ++this->_M_impl._M_finish; - } + if (this->_M_impl._M_finish != this->_M_impl._M_end_of_storage) + if (__position == end())
This could be __position == cend(), and ...
+ { + _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish, + std::forward<_Args>(__args)...); + ++this->_M_impl._M_finish; + } + else + _M_insert_aux(begin() + (__position - cbegin()),
This could use __n, and ...
+ std::forward<_Args>(__args)...); else - _M_insert_aux(begin() + (__position - cbegin()), - std::forward<_Args>(__args)...); + _M_realloc_insert_aux(begin() + (__position - cbegin()),
This could also use __n.
+ std::forward<_Args>(__args)...); + return iterator(this->_M_impl._M_start + __n); }