[libcxx-commits] [libcxx] [libcxx] adds a size-based representation for `vector`'s unstable ABI (PR #155330)
Louis Dionne via libcxx-commits
libcxx-commits at lists.llvm.org
Fri Feb 6 07:08:18 PST 2026
================
@@ -1051,11 +1048,12 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void
vector<_Tp, _Allocator>::__assign_with_size(_Iterator __first, _Sentinel __last, difference_type __n) {
size_type __new_size = static_cast<size_type>(__n);
if (__new_size <= capacity()) {
- if (__new_size > size()) {
- auto __mid = std::__copy_n<_AlgPolicy>(std::move(__first), size(), this->__begin_).first;
- __construct_at_end(std::move(__mid), std::move(__last), __new_size - size());
----------------
ldionne wrote:
We could simplify the diff slightly by refactoring this code to call `size()` only once before this PR. I'm not requesting it, but if you're up for it, I think it would be a clean, small and uncontroversial refactoring to the current code.
https://github.com/llvm/llvm-project/pull/155330
More information about the libcxx-commits
mailing list