[libcxx-commits] [libcxx] [libc++][vector] Fixes shrink_to_fit. (PR #97895)

A. Jiang via libcxx-commits libcxx-commits at lists.llvm.org
Tue Jul 9 19:40:40 PDT 2024


================
@@ -1443,7 +1443,11 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::shrink_to_fit() _NOE
 #endif // _LIBCPP_HAS_NO_EXCEPTIONS
       allocator_type& __a = this->__alloc();
       __split_buffer<value_type, allocator_type&> __v(size(), size(), __a);
----------------
frederick-vs-ja wrote:

The root problem seems to be that construction of `__split_buffer` in this way potentially calls `allocate_at_least` since C++23. Should we add tag which enforces selecting `allocate`?

https://github.com/llvm/llvm-project/pull/97895


More information about the libcxx-commits mailing list