@@ -941,7 +941,7 @@ private:
941941 __set_short_size (__size);
942942 } else {
943943 auto __capacity = __recommend (__size) + 1 ;
944- auto __allocation = __alloc_traits::allocate (__alloc () , __capacity);
944+ auto __allocation = __alloc_traits::allocate (__alloc_ , __capacity);
945945 __begin_lifetime (__allocation, __capacity);
946946 __set_long_cap (__capacity);
947947 __set_long_pointer (__allocation);
@@ -1006,7 +1006,7 @@ public:
10061006 }
10071007
10081008 _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS basic_string (const basic_string& __str)
1009- : __alloc_(__alloc_traits::select_on_container_copy_construction(__str.__alloc() )) {
1009+ : __alloc_(__alloc_traits::select_on_container_copy_construction(__str.__alloc_ )) {
10101010 if (!__str.__is_long ()) {
10111011 __rep_ = __str.__rep_ ;
10121012 __annotate_new (__get_short_size ());
@@ -1048,7 +1048,7 @@ public:
10481048
10491049 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string (basic_string&& __str, const allocator_type& __a)
10501050 : __alloc_(__a) {
1051- if (__str.__is_long () && __a != __str.__alloc () ) // copy, not move
1051+ if (__str.__is_long () && __a != __str.__alloc_ ) // copy, not move
10521052 __init (std::__to_address (__str.__get_long_pointer ()), __str.__get_long_size ());
10531053 else {
10541054 if (__libcpp_is_constant_evaluated ())
@@ -1107,7 +1107,7 @@ public:
11071107 __throw_out_of_range ();
11081108
11091109 auto __len = std::min<size_type>(__n, __str.size () - __pos);
1110- if (__alloc_traits::is_always_equal::value || __alloc == __str.__alloc () ) {
1110+ if (__alloc_traits::is_always_equal::value || __alloc == __str.__alloc_ ) {
11111111 __move_assign (std::move (__str), __pos, __len);
11121112 } else {
11131113 // Perform a copy because the allocators are not compatible.
@@ -1212,7 +1212,7 @@ public:
12121212 inline _LIBCPP_CONSTEXPR_SINCE_CXX20 ~basic_string () {
12131213 __annotate_delete ();
12141214 if (__is_long ())
1215- __alloc_traits::deallocate (__alloc () , __get_long_pointer (), __get_long_cap ());
1215+ __alloc_traits::deallocate (__alloc_ , __get_long_pointer (), __get_long_cap ());
12161216 }
12171217
12181218 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 operator __self_view () const _NOEXCEPT {
@@ -1289,7 +1289,7 @@ public:
12891289 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type length () const _NOEXCEPT { return size (); }
12901290
12911291 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type max_size () const _NOEXCEPT {
1292- size_type __m = __alloc_traits::max_size (__alloc () );
1292+ size_type __m = __alloc_traits::max_size (__alloc_ );
12931293 if (__m <= std::numeric_limits<size_type>::max () / 2 ) {
12941294 return __m - __alignment;
12951295 } else {
@@ -1409,7 +1409,7 @@ public:
14091409 template <class _InputIterator , __enable_if_t <__has_exactly_input_iterator_category<_InputIterator>::value, int > = 0 >
14101410 _LIBCPP_METHOD_TEMPLATE_IMPLICIT_INSTANTIATION_VIS _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string&
14111411 append (_InputIterator __first, _InputIterator __last) {
1412- const basic_string __temp (__first, __last, __alloc () );
1412+ const basic_string __temp (__first, __last, __alloc_ );
14131413 append (__temp.data (), __temp.size ());
14141414 return *this ;
14151415 }
@@ -1465,7 +1465,7 @@ public:
14651465#if _LIBCPP_STD_VER >= 20
14661466 _LIBCPP_HIDE_FROM_ABI constexpr void __move_assign (basic_string&& __str, size_type __pos, size_type __len) {
14671467 // Pilfer the allocation from __str.
1468- _LIBCPP_ASSERT_INTERNAL (__alloc () == __str.__alloc () , " __move_assign called with wrong allocator" );
1468+ _LIBCPP_ASSERT_INTERNAL (__alloc_ == __str.__alloc_ , " __move_assign called with wrong allocator" );
14691469 size_type __old_sz = __str.size ();
14701470 if (!__str.__is_long ())
14711471 __str.__annotate_delete ();
@@ -1571,7 +1571,7 @@ public:
15711571 return __insert_with_size (__position, ranges::begin (__range), ranges::end (__range), __n);
15721572
15731573 } else {
1574- basic_string __temp (from_range, std::forward<_Range>(__range), __alloc () );
1574+ basic_string __temp (from_range, std::forward<_Range>(__range), __alloc_ );
15751575 return insert (__position, __temp.data (), __temp.data () + __temp.size ());
15761576 }
15771577 }
@@ -1666,7 +1666,7 @@ public:
16661666 template <_ContainerCompatibleRange<_CharT> _Range>
16671667 _LIBCPP_HIDE_FROM_ABI constexpr basic_string&
16681668 replace_with_range (const_iterator __i1, const_iterator __i2, _Range&& __range) {
1669- basic_string __temp (from_range, std::forward<_Range>(__range), __alloc () );
1669+ basic_string __temp (from_range, std::forward<_Range>(__range), __alloc_ );
16701670 return replace (__i1, __i2, __temp);
16711671 }
16721672#endif
@@ -1713,7 +1713,7 @@ public:
17131713#endif
17141714
17151715 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 allocator_type get_allocator () const _NOEXCEPT {
1716- return __alloc () ;
1716+ return __alloc_ ;
17171717 }
17181718
17191719 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 size_type
@@ -1949,9 +1949,6 @@ private:
19491949 _LIBCPP_CONSTEXPR_SINCE_CXX20 iterator
19501950 __insert_with_size (const_iterator __pos, _Iterator __first, _Sentinel __last, size_type __n);
19511951
1952- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 allocator_type& __alloc () _NOEXCEPT { return __alloc_; }
1953- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR const allocator_type& __alloc () const _NOEXCEPT { return __alloc_; }
1954-
19551952 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _LIBCPP_STRING_INTERNAL_MEMORY_ACCESS void
19561953 __set_short_size (size_type __s) _NOEXCEPT {
19571954 _LIBCPP_ASSERT_INTERNAL (__s < __min_cap, " __s should never be greater than or equal to the short string capacity" );
@@ -2152,20 +2149,20 @@ private:
21522149 }
21532150
21542151 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __copy_assign_alloc (const basic_string& __str, true_type) {
2155- if (__alloc () == __str.__alloc () )
2156- __alloc () = __str.__alloc () ;
2152+ if (__alloc_ == __str.__alloc_ )
2153+ __alloc_ = __str.__alloc_ ;
21572154 else {
21582155 if (!__str.__is_long ()) {
21592156 __clear_and_shrink ();
2160- __alloc () = __str.__alloc () ;
2157+ __alloc_ = __str.__alloc_ ;
21612158 } else {
21622159 __annotate_delete ();
2163- allocator_type __a = __str.__alloc () ;
2160+ allocator_type __a = __str.__alloc_ ;
21642161 auto __allocation = std::__allocate_at_least (__a, __str.__get_long_cap ());
21652162 __begin_lifetime (__allocation.ptr , __allocation.count );
21662163 if (__is_long ())
2167- __alloc_traits::deallocate (__alloc () , __get_long_pointer (), __get_long_cap ());
2168- __alloc () = std::move (__a);
2164+ __alloc_traits::deallocate (__alloc_ , __get_long_pointer (), __get_long_cap ());
2165+ __alloc_ = std::move (__a);
21692166 __set_long_pointer (__allocation.ptr );
21702167 __set_long_cap (__allocation.count );
21712168 __set_long_size (__str.size ());
@@ -2198,7 +2195,7 @@ private:
21982195
21992196 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __move_assign_alloc (basic_string& __c, true_type)
22002197 _NOEXCEPT_(is_nothrow_move_assignable<allocator_type>::value) {
2201- __alloc () = std::move (__c.__alloc () );
2198+ __alloc_ = std::move (__c.__alloc_ );
22022199 }
22032200
22042201 _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void __move_assign_alloc (basic_string&, false_type) _NOEXCEPT {}
@@ -2321,7 +2318,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_ty
23212318 __set_short_size (__sz);
23222319 __p = __get_short_pointer ();
23232320 } else {
2324- auto __allocation = std::__allocate_at_least (__alloc () , __recommend (__reserve) + 1 );
2321+ auto __allocation = std::__allocate_at_least (__alloc_ , __recommend (__reserve) + 1 );
23252322 __p = __allocation.ptr ;
23262323 __begin_lifetime (__p, __allocation.count );
23272324 __set_long_pointer (__p);
@@ -2345,7 +2342,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init(const value_type* __s, size_ty
23452342 __set_short_size (__sz);
23462343 __p = __get_short_pointer ();
23472344 } else {
2348- auto __allocation = std::__allocate_at_least (__alloc () , __recommend (__sz) + 1 );
2345+ auto __allocation = std::__allocate_at_least (__alloc_ , __recommend (__sz) + 1 );
23492346 __p = __allocation.ptr ;
23502347 __begin_lifetime (__p, __allocation.count );
23512348 __set_long_pointer (__p);
@@ -2370,7 +2367,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init_copy_ctor_external(const value
23702367 } else {
23712368 if (__sz > max_size ())
23722369 __throw_length_error ();
2373- auto __allocation = std::__allocate_at_least (__alloc () , __recommend (__sz) + 1 );
2370+ auto __allocation = std::__allocate_at_least (__alloc_ , __recommend (__sz) + 1 );
23742371 __p = __allocation.ptr ;
23752372 __begin_lifetime (__p, __allocation.count );
23762373 __set_long_pointer (__p);
@@ -2393,7 +2390,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__
23932390 __set_short_size (__n);
23942391 __p = __get_short_pointer ();
23952392 } else {
2396- auto __allocation = std::__allocate_at_least (__alloc () , __recommend (__n) + 1 );
2393+ auto __allocation = std::__allocate_at_least (__alloc_ , __recommend (__n) + 1 );
23972394 __p = __allocation.ptr ;
23982395 __begin_lifetime (__p, __allocation.count );
23992396 __set_long_pointer (__p);
@@ -2428,7 +2425,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init_with_sentinel(_InputIterator _
24282425 } catch (...) {
24292426 __annotate_delete ();
24302427 if (__is_long ())
2431- __alloc_traits::deallocate (__alloc () , __get_long_pointer (), __get_long_cap ());
2428+ __alloc_traits::deallocate (__alloc_ , __get_long_pointer (), __get_long_cap ());
24322429 throw ;
24332430 }
24342431#endif // _LIBCPP_HAS_NO_EXCEPTIONS
@@ -2458,7 +2455,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init_with_size(_InputIterator __fir
24582455 __p = __get_short_pointer ();
24592456
24602457 } else {
2461- auto __allocation = std::__allocate_at_least (__alloc () , __recommend (__sz) + 1 );
2458+ auto __allocation = std::__allocate_at_least (__alloc_ , __recommend (__sz) + 1 );
24622459 __p = __allocation.ptr ;
24632460 __begin_lifetime (__p, __allocation.count );
24642461 __set_long_pointer (__p);
@@ -2474,7 +2471,7 @@ basic_string<_CharT, _Traits, _Allocator>::__init_with_size(_InputIterator __fir
24742471#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
24752472 } catch (...) {
24762473 if (__is_long ())
2477- __alloc_traits::deallocate (__alloc () , __get_long_pointer (), __get_long_cap ());
2474+ __alloc_traits::deallocate (__alloc_ , __get_long_pointer (), __get_long_cap ());
24782475 throw ;
24792476 }
24802477#endif // _LIBCPP_HAS_NO_EXCEPTIONS
@@ -2497,7 +2494,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__
24972494 size_type __cap =
24982495 __old_cap < __ms / 2 - __alignment ? __recommend (std::max (__old_cap + __delta_cap, 2 * __old_cap)) : __ms - 1 ;
24992496 __annotate_delete ();
2500- auto __allocation = std::__allocate_at_least (__alloc () , __cap + 1 );
2497+ auto __allocation = std::__allocate_at_least (__alloc_ , __cap + 1 );
25012498 pointer __p = __allocation.ptr ;
25022499 __begin_lifetime (__p, __allocation.count );
25032500 if (__n_copy != 0 )
@@ -2509,7 +2506,7 @@ _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__
25092506 traits_type::copy (
25102507 std::__to_address (__p) + __n_copy + __n_add, std::__to_address (__old_p) + __n_copy + __n_del, __sec_cp_sz);
25112508 if (__old_cap + 1 != __min_cap)
2512- __alloc_traits::deallocate (__alloc () , __old_p, __old_cap + 1 );
2509+ __alloc_traits::deallocate (__alloc_ , __old_p, __old_cap + 1 );
25132510 __set_long_pointer (__p);
25142511 __set_long_cap (__allocation.count );
25152512 __old_sz = __n_copy + __n_add + __sec_cp_sz;
@@ -2540,7 +2537,7 @@ _LIBCPP_DEPRECATED_("use __grow_by_without_replace") basic_string<_CharT, _Trait
25402537 size_type __cap =
25412538 __old_cap < __ms / 2 - __alignment ? __recommend (std::max (__old_cap + __delta_cap, 2 * __old_cap)) : __ms - 1 ;
25422539 __annotate_delete ();
2543- auto __allocation = std::__allocate_at_least (__alloc () , __cap + 1 );
2540+ auto __allocation = std::__allocate_at_least (__alloc_ , __cap + 1 );
25442541 pointer __p = __allocation.ptr ;
25452542 __begin_lifetime (__p, __allocation.count );
25462543 if (__n_copy != 0 )
@@ -2550,7 +2547,7 @@ _LIBCPP_DEPRECATED_("use __grow_by_without_replace") basic_string<_CharT, _Trait
25502547 traits_type::copy (
25512548 std::__to_address (__p) + __n_copy + __n_add, std::__to_address (__old_p) + __n_copy + __n_del, __sec_cp_sz);
25522549 if (__old_cap + 1 != __min_cap)
2553- __alloc_traits::deallocate (__alloc () , __old_p, __old_cap + 1 );
2550+ __alloc_traits::deallocate (__alloc_ , __old_p, __old_cap + 1 );
25542551 __set_long_pointer (__p);
25552552 __set_long_cap (__allocation.count );
25562553}
@@ -2685,7 +2682,7 @@ basic_string<_CharT, _Traits, _Allocator>::operator=(const basic_string& __str)
26852682template <class _CharT , class _Traits , class _Allocator >
26862683inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocator>::__move_assign (
26872684 basic_string& __str, false_type) noexcept (__alloc_traits::is_always_equal::value) {
2688- if (__alloc () != __str.__alloc () )
2685+ if (__alloc_ != __str.__alloc_ )
26892686 assign (__str);
26902687 else
26912688 __move_assign (__str, true_type ());
@@ -2702,7 +2699,7 @@ basic_string<_CharT, _Traits, _Allocator>::__move_assign(basic_string& __str, tr
27022699{
27032700 __annotate_delete ();
27042701 if (__is_long ()) {
2705- __alloc_traits::deallocate (__alloc () , __get_long_pointer (), __get_long_cap ());
2702+ __alloc_traits::deallocate (__alloc_ , __get_long_pointer (), __get_long_cap ());
27062703# if _LIBCPP_STD_VER <= 14
27072704 if (!is_nothrow_move_assignable<allocator_type>::value) {
27082705 __set_short_size (0 );
@@ -2752,7 +2749,7 @@ template <class _CharT, class _Traits, class _Allocator>
27522749template <class _InputIterator , class _Sentinel >
27532750_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 void
27542751basic_string<_CharT, _Traits, _Allocator>::__assign_with_sentinel (_InputIterator __first, _Sentinel __last) {
2755- const basic_string __temp (__init_with_sentinel_tag (), std::move (__first), std::move (__last), __alloc () );
2752+ const basic_string __temp (__init_with_sentinel_tag (), std::move (__first), std::move (__last), __alloc_ );
27562753 assign (__temp.data (), __temp.size ());
27572754}
27582755
@@ -2940,7 +2937,7 @@ basic_string<_CharT, _Traits, _Allocator>::append(_ForwardIterator __first, _For
29402937 traits_type::assign (*__end, value_type ());
29412938 __set_size (__sz + __n);
29422939 } else {
2943- const basic_string __temp (__first, __last, __alloc () );
2940+ const basic_string __temp (__first, __last, __alloc_ );
29442941 append (__temp.data (), __temp.size ());
29452942 }
29462943 }
@@ -3038,7 +3035,7 @@ template <class _CharT, class _Traits, class _Allocator>
30383035template <class _InputIterator , __enable_if_t <__has_exactly_input_iterator_category<_InputIterator>::value, int > >
30393036_LIBCPP_CONSTEXPR_SINCE_CXX20 typename basic_string<_CharT, _Traits, _Allocator>::iterator
30403037basic_string<_CharT, _Traits, _Allocator>::insert (const_iterator __pos, _InputIterator __first, _InputIterator __last) {
3041- const basic_string __temp (__first, __last, __alloc () );
3038+ const basic_string __temp (__first, __last, __alloc_ );
30423039 return insert (__pos, __temp.data (), __temp.data () + __temp.size ());
30433040}
30443041
@@ -3063,7 +3060,7 @@ basic_string<_CharT, _Traits, _Allocator>::__insert_with_size(
30633060 if (__string_is_trivial_iterator<_Iterator>::value && !__addr_in_range (*__first)) {
30643061 return __insert_from_safe_copy (__n, __ip, __first, __last);
30653062 } else {
3066- const basic_string __temp (__init_with_sentinel_tag (), __first, __last, __alloc () );
3063+ const basic_string __temp (__init_with_sentinel_tag (), __first, __last, __alloc_ );
30673064 return __insert_from_safe_copy (__n, __ip, __temp.begin (), __temp.end ());
30683065 }
30693066}
@@ -3200,7 +3197,7 @@ template <class _InputIterator, __enable_if_t<__has_input_iterator_category<_Inp
32003197_LIBCPP_CONSTEXPR_SINCE_CXX20 basic_string<_CharT, _Traits, _Allocator>&
32013198basic_string<_CharT, _Traits, _Allocator>::replace (
32023199 const_iterator __i1, const_iterator __i2, _InputIterator __j1, _InputIterator __j2) {
3203- const basic_string __temp (__j1, __j2, __alloc () );
3200+ const basic_string __temp (__j1, __j2, __alloc_ );
32043201 return replace (__i1, __i2, __temp);
32053202}
32063203
@@ -3372,7 +3369,7 @@ basic_string<_CharT, _Traits, _Allocator>::__shrink_or_extend(size_type __target
33723369 if (__target_capacity > __cap) {
33733370 // Extend
33743371 // - called from reserve should propagate the exception thrown.
3375- auto __allocation = std::__allocate_at_least (__alloc () , __target_capacity + 1 );
3372+ auto __allocation = std::__allocate_at_least (__alloc_ , __target_capacity + 1 );
33763373 __new_data = __allocation.ptr ;
33773374 __target_capacity = __allocation.count - 1 ;
33783375 } else {
@@ -3382,13 +3379,13 @@ basic_string<_CharT, _Traits, _Allocator>::__shrink_or_extend(size_type __target
33823379#ifndef _LIBCPP_HAS_NO_EXCEPTIONS
33833380 try {
33843381#endif // _LIBCPP_HAS_NO_EXCEPTIONS
3385- auto __allocation = std::__allocate_at_least (__alloc () , __target_capacity + 1 );
3382+ auto __allocation = std::__allocate_at_least (__alloc_ , __target_capacity + 1 );
33863383
33873384 // The Standard mandates shrink_to_fit() does not increase the capacity.
33883385 // With equal capacity keep the existing buffer. This avoids extra work
33893386 // due to swapping the elements.
33903387 if (__allocation.count - 1 > __target_capacity) {
3391- __alloc_traits::deallocate (__alloc () , __allocation.ptr , __allocation.count );
3388+ __alloc_traits::deallocate (__alloc_ , __allocation.ptr , __allocation.count );
33923389 __annotate_new (__sz); // Undoes the __annotate_delete()
33933390 return ;
33943391 }
@@ -3407,7 +3404,7 @@ basic_string<_CharT, _Traits, _Allocator>::__shrink_or_extend(size_type __target
34073404 }
34083405 traits_type::copy (std::__to_address (__new_data), std::__to_address (__p), size () + 1 );
34093406 if (__was_long)
3410- __alloc_traits::deallocate (__alloc () , __p, __cap + 1 );
3407+ __alloc_traits::deallocate (__alloc_ , __p, __cap + 1 );
34113408 if (__now_long) {
34123409 __set_long_cap (__target_capacity + 1 );
34133410 __set_long_size (__sz);
@@ -3454,14 +3451,14 @@ inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocat
34543451{
34553452 _LIBCPP_ASSERT_COMPATIBLE_ALLOCATOR (
34563453 __alloc_traits::propagate_on_container_swap::value || __alloc_traits::is_always_equal::value ||
3457- __alloc () == __str.__alloc () ,
3454+ __alloc_ == __str.__alloc_ ,
34583455 " swapping non-equal allocators" );
34593456 if (!__is_long ())
34603457 __annotate_delete ();
34613458 if (this != std::addressof (__str) && !__str.__is_long ())
34623459 __str.__annotate_delete ();
34633460 std::swap (__rep_, __str.__rep_ );
3464- std::__swap_allocator (__alloc () , __str.__alloc () );
3461+ std::__swap_allocator (__alloc_ , __str.__alloc_ );
34653462 if (!__is_long ())
34663463 __annotate_new (__get_short_size ());
34673464 if (this != std::addressof (__str) && !__str.__is_long ())
@@ -3814,7 +3811,7 @@ inline _LIBCPP_CONSTEXPR_SINCE_CXX20 void basic_string<_CharT, _Traits, _Allocat
38143811 clear ();
38153812 if (__is_long ()) {
38163813 __annotate_delete ();
3817- __alloc_traits::deallocate (__alloc () , __get_long_pointer (), capacity () + 1 );
3814+ __alloc_traits::deallocate (__alloc_ , __get_long_pointer (), capacity () + 1 );
38183815 __rep_ = __rep ();
38193816 }
38203817}
0 commit comments