@@ -119,9 +119,11 @@ public:
119119 __end_ = __begin_ + __new_size;
120120 }
121121
122- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __set_size_if_size_based (difference_type) {}
122+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __set_size_if_pointer_based (difference_type __d) {
123+ __set_sentinel (size () + __d);
124+ }
123125
124- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __set_end_if_pointer_based () { __set_sentinel ( end () + 1 ); }
126+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __set_end_if_size_based () {}
125127
126128 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __set_capacity (size_type __new_capacity) _NOEXCEPT {
127129 __cap_ = __first_ + __new_capacity;
@@ -236,10 +238,9 @@ public:
236238 __size_ = __new_size;
237239 }
238240
239- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __set_size_if_size_based (difference_type __d) {
240- __set_sentinel (size () + __d);
241- }
242- _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __set_end_if_pointer_based () {}
241+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __set_size_if_pointer_based (difference_type) {}
242+
243+ _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __set_end_if_size_based () { __set_sentinel (end () + 1 ); }
243244
244245 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_HIDE_FROM_ABI void __set_capacity (size_type __new_capacity) _NOEXCEPT {
245246 __cap_ = __new_capacity;
@@ -303,10 +304,10 @@ struct __split_buffer : _Layout<__split_buffer<_Tp, _Allocator, _Layout>, _Tp, _
303304 using __base_type::__reset;
304305 using __base_type::__set_begin;
305306 using __base_type::__set_capacity;
306- using __base_type::__set_end_if_pointer_based ;
307+ using __base_type::__set_end_if_size_based ;
307308 using __base_type::__set_first;
308309 using __base_type::__set_sentinel;
309- using __base_type::__set_size_if_size_based ;
310+ using __base_type::__set_size_if_pointer_based ;
310311 using __base_type::__swap_without_allocator;
311312
312313 using typename __base_type::__alloc_rr;
@@ -667,7 +668,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator, _Layout>::emp
667668 // `begin()` was moved further into the buffer, so we need to update the pointer-based
668669 // layout's end with it. We don't need to do anything for the size-based layout here, because
669670 // the number of elements hasn't changed yet.
670- __set_size_if_size_based (__d);
671+ __set_size_if_pointer_based (__d);
671672 } else {
672673 size_type __c = std::max<size_type>(2 * capacity (), 1 );
673674 __split_buffer<value_type, __alloc_rr&> __t (__c, (__c + 3 ) / 4 , this ->__alloc_ );
@@ -682,7 +683,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void __split_buffer<_Tp, _Allocator, _Layout>::emp
682683 // Now that we've added an element to the front of the buffer, we need to update the size-based
683684 // layout's size. We don't need to do anything for the pointer-based layout here, because the end
684685 // pointer was never updated.
685- __set_end_if_pointer_based ();
686+ __set_end_if_size_based ();
686687}
687688
688689template <class _Tp , class _Allocator , template <class , class , class > class _Layout >
0 commit comments