[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
Wed Jul 2 15:49:53 PDT 2025
================
@@ -431,52 +599,61 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::shrink_to_fi
template <class _Tp, class _Allocator>
template <class... _Args>
_LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator>::emplace_front(_Args&&... __args) {
- if (__begin_ == __first_) {
- if (__end_ < __cap_) {
- difference_type __d = __cap_ - __end_;
+ if (__data_.__begin_ == __data_.__first_) {
+ pointer __end = __data_.end();
+ if (__data_.__front_spare() != 0) {
+ difference_type __d = __data_.__back_spare();
__d = (__d + 1) / 2;
- __begin_ = std::move_backward(__begin_, __end_, __end_ + __d);
- __end_ += __d;
+ __data_.__begin_ = std::move_backward(__data_.__begin_, __end, __end + __d);
+#ifdef _LIBCPP_ABI_SIZE_BASED_CONTAINERS
+ // TODO: explain why there isn't a size-based analogue
+#else
+ __data_.__end_ += __d;
+#endif
----------------
cjdb wrote:
Comments added. I consider this resolved for now, but am leaving open in case you want to discuss it further.
https://github.com/llvm/llvm-project/pull/139632
More information about the libcxx-commits
mailing list