[libcxx-commits] [libcxx] [lldb] [libcxx] adds size-based `__split_buffer` representation to unstable ABI (PR #139632)
Christopher Di Bella via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Aug 19 18:06:19 PDT 2025
================
@@ -45,13 +47,129 @@ _LIBCPP_PUSH_MACROS
_LIBCPP_BEGIN_NAMESPACE_STD
-// __split_buffer allocates a contiguous chunk of memory and stores objects in the range [__begin_, __end_).
-// It has uninitialized memory in the ranges [__first_, __begin_) and [__end_, __cap_). That allows
-// it to grow both in the front and back without having to move the data.
+template <class _SplitBuffer, class _Tp, class _Allocator>
+class __split_buffer_pointer_layout {
+protected:
+ using value_type = _Tp;
+ using allocator_type = _Allocator;
+ using __alloc_rr _LIBCPP_NODEBUG = __libcpp_remove_reference_t<allocator_type>;
+ using __alloc_traits _LIBCPP_NODEBUG = allocator_traits<__alloc_rr>;
+ using reference = value_type&;
+ using const_reference = const value_type&;
+ using size_type = typename __alloc_traits::size_type;
+ using difference_type = typename __alloc_traits::difference_type;
+ using pointer = typename __alloc_traits::pointer;
+ using const_pointer = typename __alloc_traits::const_pointer;
+ using iterator = pointer;
+ using const_iterator = const_pointer;
+
+public: // TODO: make private after vector becomes size-based
----------------
cjdb wrote:
The primary reason for these to be public is because `vector::__swap_out_circular_buffer` needs to swap its data members with `__split_buffer`'s. I think I can get the next patch to end up refactoring this so that the equivalent `__vector_*_layout` classes can swap with `__split_buffer_*_layout` without breaking encapsulation.
https://github.com/llvm/llvm-project/pull/139632
More information about the libcxx-commits
mailing list