deque is inconsistent about using checked vs. unchecked iterators for internal operations where checking is not needed. emplace, for example:
|
template <class... _Valty>
|
|
iterator emplace(const_iterator _Where, _Valty&&... _Val) {
|
|
const auto _Off = static_cast<size_type>(_Where - begin());
|
|
|
|
#if _ITERATOR_DEBUG_LEVEL == 2
|
|
_STL_VERIFY(_Off <= _Mysize(), "deque emplace iterator outside range");
|
|
#endif // _ITERATOR_DEBUG_LEVEL == 2
|
|
|
|
if (_Off <= _Mysize() / 2) { // closer to front, push to front then rotate
|
|
emplace_front(_STD forward<_Valty>(_Val)...);
|
|
_STD rotate(begin(), _Next_iter(begin()), begin() + static_cast<difference_type>(1 + _Off));
|
|
} else { // closer to back, push to back then rotate
|
|
emplace_back(_STD forward<_Valty>(_Val)...);
|
|
_STD rotate(begin() + static_cast<difference_type>(_Off), _Prev_iter(end()), end());
|
|
}
|
|
return begin() + static_cast<difference_type>(_Off);
|
|
}
|
passes checked iterators to rotate which could as well be unchecked - we know that the ranges we're forming are valid. We need to audit the file for such occurrences and change them to use unchecked iterators (returned from _Unchecked_begin and _Unchecked_end) where possible.
dequeis inconsistent about using checked vs. unchecked iterators for internal operations where checking is not needed.emplace, for example:STL/stl/inc/deque
Lines 819 to 835 in ef62d3f
passes checked iterators to
rotatewhich could as well be unchecked - we know that the ranges we're forming are valid. We need to audit the file for such occurrences and change them to use unchecked iterators (returned from_Unchecked_beginand_Unchecked_end) where possible.