[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 Apr 3 09:54:03 PDT 2026


================
@@ -974,22 +928,15 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI vector<_Tp, _Allocato
 #else
     _NOEXCEPT_(is_nothrow_move_constructible<allocator_type>::value)
 #endif
-    : __alloc_(std::move(__x.__alloc_)) {
-  this->__begin_ = __x.__begin_;
-  this->__end_   = __x.__end_;
-  this->__cap_   = __x.__cap_;
-  __x.__begin_ = __x.__end_ = __x.__cap_ = nullptr;
+    : __layout_(std::move(__x.__layout_)) {
 }
 
 template <class _Tp, class _Allocator>
 _LIBCPP_CONSTEXPR_SINCE_CXX20 inline _LIBCPP_HIDE_FROM_ABI
 vector<_Tp, _Allocator>::vector(vector&& __x, const __type_identity_t<allocator_type>& __a)
-    : __alloc_(__a) {
-  if (__a == __x.__alloc_) {
-    this->__begin_ = __x.__begin_;
-    this->__end_   = __x.__end_;
-    this->__cap_   = __x.__cap_;
-    __x.__begin_ = __x.__end_ = __x.__cap_ = nullptr;
+    : __layout_(__a) {
+  if (__a == __x.__layout_.__alloc()) {
+    __layout_.__move_without_allocator(__x.__layout_);
----------------
ldionne wrote:

I feel like we're probably better off not doing this refactor in this patch to avoid increasing the scope even more. Let's keep as-is for now.

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


More information about the libcxx-commits mailing list