[libcxx-commits] [libcxx] [libcxx] adds a size-based representation for `vector`'s unstable ABI (PR #155330)
Christopher Di Bella via libcxx-commits
libcxx-commits at lists.llvm.org
Wed Jan 14 17:26:30 PST 2026
================
@@ -1386,55 +1716,21 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::resize(size_type __n
if (__new_size <= capacity())
__construct_at_end(__new_size - __current_size, __x);
else {
- __split_buffer<value_type, allocator_type&> __v(__recommend(__new_size), __current_size, __alloc_);
+ __split_buffer __v(__recommend(__new_size), __current_size, __allocator_ref());
__v.__construct_at_end(__new_size - __current_size, __x);
__swap_out_circular_buffer(__v);
}
} else if (__current_size > __new_size) {
- this->__destruct_at_end(this->__begin_ + __new_size);
+ this->__destruct_at_end(__raw_begin() + __new_size);
}
}
-template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 void vector<_Tp, _Allocator>::swap(vector& __x)
-#if _LIBCPP_STD_VER >= 14
- _NOEXCEPT
-#else
- _NOEXCEPT_(!__alloc_traits::propagate_on_container_swap::value || __is_nothrow_swappable_v<allocator_type>)
-#endif
-{
- _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR(
- __alloc_traits::propagate_on_container_swap::value || this->__alloc_ == __x.__alloc_,
- "vector::swap: Either propagate_on_container_swap must be true"
- " or the allocators must compare equal");
- std::swap(this->__begin_, __x.__begin_);
- std::swap(this->__end_, __x.__end_);
- std::swap(this->__cap_, __x.__cap_);
- std::__swap_allocator(this->__alloc_, __x.__alloc_);
-}
-
-template <class _Tp, class _Allocator>
-_LIBCPP_CONSTEXPR_SINCE_CXX20 bool vector<_Tp, _Allocator>::__invariants() const {
- if (this->__begin_ == nullptr) {
- if (this->__end_ != nullptr || this->__cap_ != nullptr)
- return false;
- } else {
- if (this->__begin_ > this->__end_)
- return false;
- if (this->__begin_ == this->__cap_)
- return false;
- if (this->__end_ > this->__cap_)
- return false;
- }
- return true;
-}
-
#if _LIBCPP_STD_VER >= 20
-template <>
-inline constexpr bool __format::__enable_insertable<vector<char>> = true;
+template <class _Allocator>
+inline constexpr bool __format::__enable_insertable<vector<char, _Allocator>> = true;
----------------
cjdb wrote:
Removed.
https://github.com/llvm/llvm-project/pull/155330
More information about the libcxx-commits
mailing list