]> git.ipfire.org Git - thirdparty/gcc.git/commit
libstdc++: Replace some implicit conversions in std::vector
authorJonathan Wakely <jwakely@redhat.com>
Thu, 29 May 2025 10:40:59 +0000 (11:40 +0100)
committerJonathan Wakely <redi@gcc.gnu.org>
Tue, 3 Jun 2025 09:53:00 +0000 (10:53 +0100)
commit4db88b963b0966f14cd5bdab183f9bca355a0cd2
tree69937f9aaf0bef380f32c5c2198b1c8f5a708d07
parentf12151e527d8d1b39a26b196f3de768c7edce5d0
libstdc++: Replace some implicit conversions in std::vector

This replaces two implicit conversions from ptrdiff_t to size_t with
explicit conversions that include unreachable hints for the ptrdiff_t
value not being negative.

libstdc++-v3/ChangeLog:

* include/bits/stl_vector.h (~_Vector_base): Add unreachable
hint for negative capacity and cast to size_t explicitly.
* include/bits/vector.tcc (vector::_M_realloc_append): Use
size() instead of end() - begin().

Reviewed-by: Tomasz KamiƄski <tkaminsk@redhat.com>
libstdc++-v3/include/bits/stl_vector.h
libstdc++-v3/include/bits/vector.tcc