Extend usage of C++11 direct init in __debug::vector
François Dumont
frs.dumont@gmail.com
Mon Oct 15 05:24:00 GMT 2018
This patch extend usage of C++11 direct initialization in
__debug::vector and makes some calls to operator - more consistent.
Note that I also rewrote following expression in erase method:
-Â Â Â Â return begin() + (__first.base() - cbegin().base());
+Â Â Â Â return { _Base::begin() + (__first.base() - _Base::cbegin()), this };
The latter version was building 2 safe iterators and incrementing 1 with
the additional debug check inherent to such an operation whereas the new
version just build 1 safe iterator with directly the expected offset.
2018-10-15 François Dumont <fdumont@gcc.gnu.org>
   * include/debug/vector (vector<>::cbegin()): Use C++11 direct
   initialization.
   (vector<>::cend()): Likewise.
   (vector<>::emplace(const_iterator, _Args&&...)): Likewise and use
   consistent iterator comparison.
   (vector<>::insert(const_iterator, size_type, const _Tp&)): Likewise.
   (vector<>::insert(const_iterator, _InputIterator, _InputIterator)):
   Likewise.
   (vector<>::erase(const_iterator)): Likewise.
   (vector<>::erase(const_iterator, const_iterator)): Likewise.
Tested under Linux x86_64 Debug mode and committed.
François
-------------- next part --------------
A non-text attachment was scrubbed...
Name: debug_vector.patch
Type: text/x-patch
Size: 3174 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/libstdc++/attachments/20181015/615061e4/attachment.bin>
More information about the Libstdc++
mailing list