From ce3390c91cd2941bf06375a784bd0e1b7b5e98fc Mon Sep 17 00:00:00 2001 From: "A. Jiang" Date: Thu, 8 May 2025 00:06:02 +0800 Subject: [PATCH 1/2] Replace `_GET_PROXY_ALLOCATOR` with a function template --- stl/inc/forward_list | 11 +++++------ stl/inc/list | 22 +++++++++++----------- stl/inc/vector | 42 +++++++++++++++++++++--------------------- stl/inc/xhash | 14 +++++++------- stl/inc/xmemory | 14 +++++++++++--- stl/inc/xstring | 34 +++++++++++++++++----------------- stl/inc/xtree | 18 +++++++++--------- 7 files changed, 81 insertions(+), 74 deletions(-) diff --git a/stl/inc/forward_list b/stl/inc/forward_list index 7d7dfb8db11..8abac81f0c9 100644 --- a/stl/inc/forward_list +++ b/stl/inc/forward_list @@ -675,7 +675,7 @@ public: if (_Al != _Right_al) { _Mypair._Myval2._Orphan_all(); clear(); - _Mypair._Myval2._Reload_proxy(_GET_PROXY_ALLOCATOR(_Alty, _Al), _GET_PROXY_ALLOCATOR(_Alty, _Right_al)); + _Mypair._Myval2._Reload_proxy(_STD _Get_proxy_allocator(_Al), _Get_proxy_allocator(_Right_al)); _Pocma(_Al, _Right_al); _Take_head(_Right); return *this; @@ -741,7 +741,7 @@ private: public: forward_list(initializer_list<_Ty> _Ilist, const _Alloc& _Al = allocator_type()) : _Mypair(_One_then_variadic_args_t{}, _Al) { - auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alnode, _Getal()); + auto _Alproxy = _STD _Get_proxy_allocator(_Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); insert_after(before_begin(), _Ilist.begin(), _Ilist.end()); _Proxy._Release(); @@ -764,7 +764,7 @@ public: ~forward_list() noexcept { clear(); #if _ITERATOR_DEBUG_LEVEL != 0 // TRANSITION, ABI - auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Getal()); + auto _Alproxy = _STD _Get_proxy_allocator(_Getal()); _Delete_plain_internal(_Alproxy, _Mypair._Myval2._Myproxy); #endif // _ITERATOR_DEBUG_LEVEL != 0 } @@ -780,8 +780,7 @@ public: if (_Al != _Right_al) { _Mypair._Myval2._Orphan_all(); clear(); - _Mypair._Myval2._Reload_proxy( - _GET_PROXY_ALLOCATOR(_Alnode, _Al), _GET_PROXY_ALLOCATOR(_Alnode, _Right_al)); + _Mypair._Myval2._Reload_proxy(_STD _Get_proxy_allocator(_Al), _STD _Get_proxy_allocator(_Right_al)); } } @@ -1551,7 +1550,7 @@ private: } void _Alloc_proxy() { - _Mypair._Myval2._Alloc_proxy(_GET_PROXY_ALLOCATOR(_Alnode, _Getal())); + _Mypair._Myval2._Alloc_proxy(_STD _Get_proxy_allocator(_Getal())); } void _Swap_proxy_and_iterators(forward_list& _Right) noexcept { diff --git a/stl/inc/list b/stl/inc/list index 446649dcef4..445347c1889 100644 --- a/stl/inc/list +++ b/stl/inc/list @@ -824,7 +824,7 @@ private: } void _Construct_n(_CRT_GUARDOVERFLOW size_type _Count) { - auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alnode, _Getal()); + auto _Alproxy = _STD _Get_proxy_allocator(_Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _List_node_insert_op2<_Alnode> _Appended(_Getal()); _Appended._Append_n(_Count); @@ -845,7 +845,7 @@ public: private: void _Construct_n(_CRT_GUARDOVERFLOW size_type _Count, const _Ty& _Val) { - auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alnode, _Getal()); + auto _Alproxy = _STD _Get_proxy_allocator(_Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _List_node_insert_op2<_Alnode> _Appended(_Getal()); _Appended._Append_n(_Count, _Val); @@ -870,7 +870,7 @@ public: private: template void _Construct_range_unchecked(_Iter _First, const _Sent _Last) { - auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alnode, _Getal()); + auto _Alproxy = _STD _Get_proxy_allocator(_Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _List_node_insert_op2<_Alnode> _Appended(_Getal()); _Appended._Append_range_unchecked(_STD move(_First), _Last); @@ -940,8 +940,8 @@ public: constexpr auto _Pocma_val = _Choose_pocma_v<_Alnode>; if constexpr (_Pocma_val == _Pocma_values::_Propagate_allocators) { if (_Al != _Right_al) { - auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alnode, _Al); - auto&& _Right_alproxy = _GET_PROXY_ALLOCATOR(_Alnode, _Right_al); + auto _Alproxy = _STD _Get_proxy_allocator(_Al); + auto _Right_alproxy = _STD _Get_proxy_allocator(_Right_al); _Container_proxy_ptr<_Alty> _Proxy(_Right_alproxy, _Leave_proxy_unbound{}); auto& _My_data = _Mypair._Myval2; auto& _Right_data = _Right._Mypair._Myval2; @@ -1060,17 +1060,17 @@ public: ~list() noexcept { _Tidy(); #if _ITERATOR_DEBUG_LEVEL != 0 // TRANSITION, ABI - auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alnode, _Getal()); + auto _Alproxy = _STD _Get_proxy_allocator(_Getal()); _Delete_plain_internal(_Alproxy, _Mypair._Myval2._Myproxy); #endif // _ITERATOR_DEBUG_LEVEL != 0 } private: void _Reload_sentinel_and_proxy(const list& _Right) { // reload sentinel / proxy from unequal POCCA _Right - auto& _Al = _Getal(); - auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alnode, _Al); - auto& _Right_al = _Right._Getal(); - auto&& _Right_alproxy = _GET_PROXY_ALLOCATOR(_Alnode, _Right_al); + auto& _Al = _Getal(); + auto _Alproxy = _STD _Get_proxy_allocator(_Al); + auto& _Right_al = _Right._Getal(); + auto _Right_alproxy = _STD _Get_proxy_allocator(_Right_al); _Container_proxy_ptr<_Alty> _Proxy(_Right_alproxy, _Leave_proxy_unbound{}); auto _Right_al_non_const = _Right_al; auto _Newhead = _Node::_Buyheadnode(_Right_al_non_const); @@ -1845,7 +1845,7 @@ private: } void _Alloc_sentinel_and_proxy() { - auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alnode, _Getal()); + auto _Alproxy = _STD _Get_proxy_allocator(_Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); auto& _Al = _Getal(); auto _Newhead = _Al.allocate(1); diff --git a/stl/inc/vector b/stl/inc/vector index 1ef309dffa7..b84dbda19d3 100644 --- a/stl/inc/vector +++ b/stl/inc/vector @@ -668,11 +668,11 @@ public: using const_reverse_iterator = _STD reverse_iterator; _CONSTEXPR20 vector() noexcept(is_nothrow_default_constructible_v<_Alty>) : _Mypair(_Zero_then_variadic_args_t{}) { - _Mypair._Myval2._Alloc_proxy(_GET_PROXY_ALLOCATOR(_Alty, _Getal())); + _Mypair._Myval2._Alloc_proxy(_STD _Get_proxy_allocator(_Getal())); } _CONSTEXPR20 explicit vector(const _Alloc& _Al) noexcept : _Mypair(_One_then_variadic_args_t{}, _Al) { - _Mypair._Myval2._Alloc_proxy(_GET_PROXY_ALLOCATOR(_Alty, _Getal())); + _Mypair._Myval2._Alloc_proxy(_STD _Get_proxy_allocator(_Getal())); } _CONSTEXPR20 explicit vector(_CRT_GUARDOVERFLOW const size_type _Count, const _Alloc& _Al = _Alloc()) @@ -705,7 +705,7 @@ public: _Construct_n(_Count, _STD move(_UFirst), _STD move(_ULast)); #endif // _HAS_CXX20 } else { - auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Getal()); + auto _Alproxy = _STD _Get_proxy_allocator(_Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _Tidy_guard _Guard{this}; @@ -730,7 +730,7 @@ public: const auto _Count = _Convert_size(_Length); _Construct_n(_Count, _RANGES _Ubegin(_Range), _RANGES _Uend(_Range)); } else { - auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Getal()); + auto _Alproxy = _STD _Get_proxy_allocator(_Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _Mypair._Myval2); _Tidy_guard _Guard{this}; @@ -761,7 +761,7 @@ public: _STD exchange(_Right._Mypair._Myval2._Myfirst, nullptr), _STD exchange(_Right._Mypair._Myval2._Mylast, nullptr), _STD exchange(_Right._Mypair._Myval2._Myend, nullptr)) { - _Mypair._Myval2._Alloc_proxy(_GET_PROXY_ALLOCATOR(_Alty, _Getal())); + _Mypair._Myval2._Alloc_proxy(_STD _Get_proxy_allocator(_Getal())); _Mypair._Myval2._Swap_proxy_and_iterators(_Right._Mypair._Myval2); } @@ -769,7 +769,7 @@ public: noexcept(_Alty_traits::is_always_equal::value) // strengthened : _Mypair(_One_then_variadic_args_t{}, _Al_) { _Alty& _Al = _Getal(); - auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Al); + auto _Alproxy = _STD _Get_proxy_allocator(_Al); auto& _My_data = _Mypair._Myval2; auto& _Right_data = _Right._Mypair._Myval2; _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _My_data); @@ -816,7 +816,7 @@ public: if constexpr (_Pocma_val == _Pocma_values::_Propagate_allocators) { if (_Al != _Right_al) { // intentionally slams into noexcept on OOM, TRANSITION, VSO-466800 - _Mypair._Myval2._Reload_proxy(_GET_PROXY_ALLOCATOR(_Alty, _Al), _GET_PROXY_ALLOCATOR(_Alty, _Right_al)); + _Mypair._Myval2._Reload_proxy(_STD _Get_proxy_allocator(_Al), _STD _Get_proxy_allocator(_Right_al)); } } #endif // _ITERATOR_DEBUG_LEVEL != 0 @@ -829,7 +829,7 @@ public: _CONSTEXPR20 ~vector() noexcept { _Tidy(); #if _ITERATOR_DEBUG_LEVEL != 0 - auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Getal()); + auto _Alproxy = _STD _Get_proxy_allocator(_Getal()); _Delete_plain_internal(_Alproxy, _STD exchange(_Mypair._Myval2._Myproxy, nullptr)); #endif // _ITERATOR_DEBUG_LEVEL != 0 } @@ -1530,7 +1530,7 @@ public: if constexpr (_Choose_pocca_v<_Alty>) { if (_Al != _Right_al) { _Tidy(); - _Mypair._Myval2._Reload_proxy(_GET_PROXY_ALLOCATOR(_Alty, _Al), _GET_PROXY_ALLOCATOR(_Alty, _Right_al)); + _Mypair._Myval2._Reload_proxy(_STD _Get_proxy_allocator(_Al), _STD _Get_proxy_allocator(_Right_al)); } } @@ -2104,9 +2104,9 @@ private: // 1-arg -> value-construction, e.g. vector(5) // 2-arg -> fill, e.g. vector(5, "meow") // 3-arg -> sized range construction, e.g. vector{"Hello", "Fluffy", "World"} - auto& _Al = _Getal(); - auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Al); - auto& _My_data = _Mypair._Myval2; + auto& _Al = _Getal(); + auto _Alproxy = _STD _Get_proxy_allocator(_Al); + auto& _My_data = _Mypair._Myval2; _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _My_data); if (_Count != 0) { _Buy_nonzero(_Count); @@ -2816,35 +2816,35 @@ public: using size_type = typename _Alvbase_traits::size_type; _CONSTEXPR20 _Vb_val() noexcept(is_nothrow_default_constructible_v<_Vectype>) : _Myvec(), _Mysize(0) { - this->_Alloc_proxy(_GET_PROXY_ALLOCATOR(_Alvbase, _Getal())); + this->_Alloc_proxy(_STD _Get_proxy_allocator(_Getal())); } _CONSTEXPR20 _Vb_val(const _Alloc& _Al) noexcept : _Myvec(static_cast<_Alvbase>(_Al)), _Mysize(0) { - this->_Alloc_proxy(_GET_PROXY_ALLOCATOR(_Alvbase, _Getal())); + this->_Alloc_proxy(_STD _Get_proxy_allocator(_Getal())); } _CONSTEXPR20 _Vb_val(size_type _Count, const bool& _Val) : _Myvec(_Nw(_Count), static_cast<_Vbase>(_Val ? -1 : 0)), _Mysize(0) { - this->_Alloc_proxy(_GET_PROXY_ALLOCATOR(_Alvbase, _Getal())); + this->_Alloc_proxy(_STD _Get_proxy_allocator(_Getal())); } _CONSTEXPR20 _Vb_val(size_type _Count, const bool& _Val, const _Alloc& _Al) : _Myvec(_Nw(_Count), static_cast<_Vbase>(_Val ? -1 : 0), static_cast<_Alvbase>(_Al)), _Mysize(0) { - this->_Alloc_proxy(_GET_PROXY_ALLOCATOR(_Alvbase, _Getal())); + this->_Alloc_proxy(_STD _Get_proxy_allocator(_Getal())); } _CONSTEXPR20 _Vb_val(const _Vb_val& _Right) : _Myvec(_Right._Myvec), _Mysize(_Right._Mysize) { - this->_Alloc_proxy(_GET_PROXY_ALLOCATOR(_Alvbase, _Getal())); + this->_Alloc_proxy(_STD _Get_proxy_allocator(_Getal())); } _CONSTEXPR20 _Vb_val(const _Vb_val& _Right, const _Alloc& _Al) : _Myvec(_Right._Myvec, static_cast<_Alvbase>(_Al)), _Mysize(_Right._Mysize) { - this->_Alloc_proxy(_GET_PROXY_ALLOCATOR(_Alvbase, _Getal())); + this->_Alloc_proxy(_STD _Get_proxy_allocator(_Getal())); } _CONSTEXPR20 _Vb_val(_Vb_val&& _Right) noexcept(is_nothrow_move_constructible_v<_Vectype>) : _Myvec(_STD move(_Right._Myvec)), _Mysize(_STD exchange(_Right._Mysize, size_type{0})) { - this->_Alloc_proxy(_GET_PROXY_ALLOCATOR(_Alvbase, _Getal())); + this->_Alloc_proxy(_STD _Get_proxy_allocator(_Getal())); } _CONSTEXPR20 _Vb_val(_Vb_val&& _Right, const _Alloc& _Al) @@ -2855,13 +2855,13 @@ public: _Right._Mysize = 0; } - this->_Alloc_proxy(_GET_PROXY_ALLOCATOR(_Alvbase, _Getal())); + this->_Alloc_proxy(_STD _Get_proxy_allocator(_Getal())); } _CONSTEXPR20 ~_Vb_val() noexcept { #if _ITERATOR_DEBUG_LEVEL != 0 this->_Orphan_all(); - auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alvbase, this->_Getal()); + auto _Alproxy = _STD _Get_proxy_allocator(this->_Getal()); _Delete_plain_internal(_Alproxy, _STD exchange(this->_Myproxy, nullptr)); #endif // _ITERATOR_DEBUG_LEVEL != 0 diff --git a/stl/inc/xhash b/stl/inc/xhash index beb31a12d26..8ad550329c9 100644 --- a/stl/inc/xhash +++ b/stl/inc/xhash @@ -252,13 +252,13 @@ struct _Hash_vec { _Vec_iter_types>>; _Hash_vec() : _Mypair(_Zero_then_variadic_args_t{}) { - _Mypair._Myval2._Alloc_proxy(_GET_PROXY_ALLOCATOR(_Aliter, _Mypair._Get_first())); + _Mypair._Myval2._Alloc_proxy(_STD _Get_proxy_allocator(_Mypair._Get_first())); } template , _Hash_vec>, int> = 0> explicit _Hash_vec(_Any_alloc&& _Al) noexcept : _Mypair(_One_then_variadic_args_t{}, _STD forward<_Any_alloc>(_Al)) { // construct empty vector, allocator - _Mypair._Myval2._Alloc_proxy(_GET_PROXY_ALLOCATOR(_Aliter, _Mypair._Get_first())); + _Mypair._Myval2._Alloc_proxy(_STD _Get_proxy_allocator(_Mypair._Get_first())); } _Hash_vec(const _Hash_vec&) = delete; @@ -316,7 +316,7 @@ struct _Hash_vec { ~_Hash_vec() { _Tidy(); #if _ITERATOR_DEBUG_LEVEL != 0 - auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Aliter, _Mypair._Get_first()); + auto _Alproxy = _STD _Get_proxy_allocator(_Mypair._Get_first()); _Delete_plain_internal(_Alproxy, _STD exchange(_Mypair._Myval2._Myproxy, nullptr)); #endif // _ITERATOR_DEBUG_LEVEL != 0 } @@ -523,8 +523,8 @@ public: if constexpr (_Pocma_val == _Pocma_values::_Propagate_allocators) { if (_Al != _Right_al) { // allocate all the parts necessary to maintain _Hash invariants using _Right's allocator - auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alnode, _Al); - auto&& _Right_alproxy = _GET_PROXY_ALLOCATOR(_Alnode, _Right_al); + auto _Alproxy = _STD _Get_proxy_allocator(_Al); + auto _Right_alproxy = _STD _Get_proxy_allocator(_Right_al); _Container_proxy_ptr<_Alnode> _List_proxy(_Right_alproxy, _Leave_proxy_unbound{}); _Container_proxy_ptr<_Alnode> _Vec_proxy(_Right_alproxy, _Leave_proxy_unbound{}); _List_head_construct_ptr<_Alnode> _Newhead(_Right_al); @@ -758,8 +758,8 @@ public: auto& _Al = _Getal(); const auto& _Right_al = _Right._Getal(); if (_Al != _Right_al) { - auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alnode, _Al); - auto&& _Right_alproxy = _GET_PROXY_ALLOCATOR(_Alnode, _Right_al); + auto _Alproxy = _STD _Get_proxy_allocator(_Al); + auto _Right_alproxy = _STD _Get_proxy_allocator(_Right_al); _Container_proxy_ptr<_Alnode> _Vec_proxy(_Right_alproxy, _Leave_proxy_unbound{}); _List._Reload_sentinel_and_proxy(_Right._List); _Vec._Tidy(); diff --git a/stl/inc/xmemory b/stl/inc/xmemory index 80041fc71bc..757a87c58fe 100644 --- a/stl/inc/xmemory +++ b/stl/inc/xmemory @@ -1504,12 +1504,20 @@ struct _Container_proxy_ptr12 : _Basic_container_proxy_ptr12 { }; #if _ITERATOR_DEBUG_LEVEL == 0 -#define _GET_PROXY_ALLOCATOR(_Alty, _Al) \ - _Fake_allocator {} +template +_CONSTEXPR20 _Fake_allocator _Get_proxy_allocator(const _Alloc&) noexcept { + return {}; +} + template using _Container_proxy_ptr = _Fake_proxy_ptr_impl; #else // ^^^ _ITERATOR_DEBUG_LEVEL == 0 / _ITERATOR_DEBUG_LEVEL > 0 vvv -#define _GET_PROXY_ALLOCATOR(_Alty, _Al) static_cast<_Rebind_alloc_t<_Alty, _Container_proxy>>(_Al) +template +_CONSTEXPR20 _Rebind_alloc_t<_Alloc, _Container_proxy> _Get_proxy_allocator(const _Alloc& _Al) + noexcept(noexcept(static_cast<_Rebind_alloc_t<_Alloc, _Container_proxy>>(_Al))) { + return static_cast<_Rebind_alloc_t<_Alloc, _Container_proxy>>(_Al); +} + template using _Container_proxy_ptr = _Container_proxy_ptr12<_Rebind_alloc_t<_Alloc, _Container_proxy>>; #endif // ^^^ _ITERATOR_DEBUG_LEVEL > 0 ^^^ diff --git a/stl/inc/xstring b/stl/inc/xstring index 5d5be98ae12..0ac07f32221 100644 --- a/stl/inc/xstring +++ b/stl/inc/xstring @@ -899,7 +899,7 @@ private: _CONSTEXPR20 void _Construct_empty() { auto& _My_data = _Mypair._Myval2; - _My_data._Alloc_proxy(_GET_PROXY_ALLOCATOR(_Alty, _Getal())); + _My_data._Alloc_proxy(_STD _Get_proxy_allocator(_Getal())); // initialize basic_string data members _My_data._Mysize = 0; @@ -927,8 +927,8 @@ private: _Xlen_string(); // result too long } - auto& _Al = _Getal(); - auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Al); + auto& _Al = _Getal(); + auto _Alproxy = _STD _Get_proxy_allocator(_Al); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _My_data); if (_Count <= _Small_string_capacity) { @@ -982,9 +982,9 @@ private: // Pre: if is_same_v<_Size, size_type>, _Count is the length of [_First, _Last). // Pre: *this is in small mode; the lifetime of the SSO elements has already begun. - auto& _My_data = _Mypair._Myval2; - auto& _Al = _Getal(); - auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Al); + auto& _My_data = _Mypair._Myval2; + auto& _Al = _Getal(); + auto _Alproxy = _STD _Get_proxy_allocator(_Al); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _My_data); _My_data._Mysize = 0; @@ -1071,7 +1071,7 @@ public: _CONSTEXPR20 basic_string(basic_string&& _Right) noexcept : _Mypair(_One_then_variadic_args_t{}, _STD move(_Right._Getal())) { - _Mypair._Myval2._Alloc_proxy(_GET_PROXY_ALLOCATOR(_Alty, _Getal())); + _Mypair._Myval2._Alloc_proxy(_STD _Get_proxy_allocator(_Getal())); _Take_contents(_Right); } @@ -1086,7 +1086,7 @@ public: } } - _Mypair._Myval2._Alloc_proxy(_GET_PROXY_ALLOCATOR(_Alty, _Getal())); + _Mypair._Myval2._Alloc_proxy(_STD _Get_proxy_allocator(_Getal())); _Take_contents(_Right); } @@ -1102,7 +1102,7 @@ public: size_type _New_capacity = _Small_string_capacity; auto& _My_data = _Mypair._Myval2; _Elem* _Ptr = _My_data._Bx._Buf; - auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Getal()); + auto _Alproxy = _STD _Get_proxy_allocator(_Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _My_data); // throws if (_New_capacity < _New_size) { @@ -1138,7 +1138,7 @@ public: const bool _Fits_in_left = _Right_size <= _Left_capacity - _Left_size; if (_Fits_in_left && _Right_capacity <= _Left_capacity) { // take _Left's buffer, max_size() is OK because _Fits_in_left - _My_data._Alloc_proxy(_GET_PROXY_ALLOCATOR(_Alty, _Getal())); // throws, hereafter nothrow in this block + _My_data._Alloc_proxy(_STD _Get_proxy_allocator(_Getal())); // throws, hereafter nothrow in this block _Take_contents(_Left); const auto _Ptr = _My_data._Myptr(); _ASAN_STRING_MODIFY(*this, _Left_size, _New_size); @@ -1159,7 +1159,7 @@ public: // || (_Right_capacity > _Left_capacity && _Fits_in_right) // tests that _Right has more capacity // therefore: _Right must have more than the minimum capacity, so it must be _Large_mode_engaged() _STL_INTERNAL_CHECK(_Right_data._Large_mode_engaged()); - _My_data._Alloc_proxy(_GET_PROXY_ALLOCATOR(_Alty, _Getal())); // throws, hereafter nothrow in this block + _My_data._Alloc_proxy(_STD _Get_proxy_allocator(_Getal())); // throws, hereafter nothrow in this block _Take_contents(_Right); const auto _Ptr = _Unfancy(_My_data._Bx._Ptr); _ASAN_STRING_MODIFY(*this, _Right_size, _New_size); @@ -1176,7 +1176,7 @@ public: } size_type _New_capacity = _Calculate_growth(_New_size, _Small_string_capacity, _Max); - auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Getal()); + auto _Alproxy = _STD _Get_proxy_allocator(_Getal()); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _My_data); // throws const pointer _Fancyptr = _Allocate_for_capacity(_Getal(), _New_capacity); // throws // nothrow hereafter @@ -1279,7 +1279,7 @@ public: if (_Al != _Right_al) { // intentionally slams into noexcept on OOM, TRANSITION, VSO-466800 _Mypair._Myval2._Orphan_all(); - _Mypair._Myval2._Reload_proxy(_GET_PROXY_ALLOCATOR(_Alty, _Al), _GET_PROXY_ALLOCATOR(_Alty, _Right_al)); + _Mypair._Myval2._Reload_proxy(_STD _Get_proxy_allocator(_Al), _STD _Get_proxy_allocator(_Right_al)); } } else if constexpr (_Pocma_val == _Pocma_values::_No_propagate_allocators) { if (_Al != _Right_al) { @@ -1368,7 +1368,7 @@ private: const auto _Right_ptr = _Right_data._Myptr(); auto& _Al = _Getal(); if (_Allocators_equal(_Al, _Right._Getal()) && _Result_size > _Small_string_capacity) { - _Mypair._Myval2._Alloc_proxy(_GET_PROXY_ALLOCATOR(_Alty, _Al)); + _Mypair._Myval2._Alloc_proxy(_STD _Get_proxy_allocator(_Al)); if (_Roff != 0) { _Traits::move(_Right_ptr, _Right_ptr + _Roff, _Result_size); @@ -1427,7 +1427,7 @@ public: _CONSTEXPR20 ~basic_string() noexcept { _Tidy_deallocate(); #if _ITERATOR_DEBUG_LEVEL != 0 - auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Getal()); + auto _Alproxy = _STD _Get_proxy_allocator(_Getal()); const auto _To_delete = _Mypair._Myval2._Myproxy; _Mypair._Myval2._Myproxy = nullptr; _Delete_plain_internal(_Alproxy, _To_delete); @@ -1445,8 +1445,8 @@ public: const auto& _Right_al = _Right._Getal(); if constexpr (_Choose_pocca_v<_Alty>) { if (_Al != _Right_al) { - auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Al); - auto&& _Right_alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Right_al); + auto _Alproxy = _STD _Get_proxy_allocator(_Al); + auto _Right_alproxy = _STD _Get_proxy_allocator(_Right_al); _Container_proxy_ptr<_Alty> _New_proxy(_Right_alproxy, _Leave_proxy_unbound{}); // throws const size_type _Right_size = _Right._Mypair._Myval2._Mysize; diff --git a/stl/inc/xtree b/stl/inc/xtree index 783c05f15a9..bfbadffced9 100644 --- a/stl/inc/xtree +++ b/stl/inc/xtree @@ -914,7 +914,7 @@ public: _Tree(const _Tree& _Right, _Any_alloc&& _Al) : _Mypair(_One_then_variadic_args_t{}, _Right.key_comp(), _One_then_variadic_args_t{}, _STD forward<_Any_alloc>(_Al)) { - auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alnode, _Getal()); + auto _Alproxy = _STD _Get_proxy_allocator(_Getal()); const auto _Scary = _Get_scary(); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, *_Scary); _Tree_head_scoped_ptr<_Alnode, _Scary_val> _Sentinel(_Getal(), *_Scary); @@ -935,7 +935,7 @@ public: _One_then_variadic_args_t{}, _Al) { if constexpr (!_Alnode_traits::is_always_equal::value) { if (_Getal() != _Right._Getal()) { - auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alnode, _Getal()); + auto _Alproxy = _STD _Get_proxy_allocator(_Getal()); const auto _Scary = _Get_scary(); _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, *_Scary); _Tree_head_scoped_ptr<_Alnode, _Scary_val> _Sentinel(_Getal(), *_Scary); @@ -962,9 +962,9 @@ public: if constexpr (_Pocma_val == _Pocma_values::_Propagate_allocators) { if (_Al != _Right_al) { clear(); - _Getcomp() = _Right._Getcomp(); // intentionally copy comparator, see LWG-2227 - auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alnode, _Al); - auto&& _Right_alproxy = _GET_PROXY_ALLOCATOR(_Alnode, _Right_al); + _Getcomp() = _Right._Getcomp(); // intentionally copy comparator, see LWG-2227 + auto _Alproxy = _STD _Get_proxy_allocator(_Al); + auto _Right_alproxy = _STD _Get_proxy_allocator(_Right_al); _Container_proxy_ptr<_Alty> _Proxy(_Right_alproxy, _Leave_proxy_unbound{}); const auto _Scary = _Get_scary(); const auto _Right_scary = _Right._Get_scary(); @@ -1096,7 +1096,7 @@ public: const auto _Scary = _Get_scary(); _Scary->_Erase_head(_Getal()); #if _ITERATOR_DEBUG_LEVEL != 0 // TRANSITION, ABI - auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alnode, _Getal()); + auto _Alproxy = _STD _Get_proxy_allocator(_Getal()); _Delete_plain_internal(_Alproxy, _Scary->_Myproxy); #endif // _ITERATOR_DEBUG_LEVEL != 0 } @@ -1114,8 +1114,8 @@ public: clear(); const auto _Scary = _Get_scary(); _Scary->_Orphan_all(); - auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alnode, _Al); - auto&& _Right_alproxy = _GET_PROXY_ALLOCATOR(_Alnode, _Right_al); + auto _Alproxy = _STD _Get_proxy_allocator(_Al); + auto _Right_alproxy = _STD _Get_proxy_allocator(_Right_al); _Container_proxy_ptr<_Alty> _Proxy(_Right_alproxy, _Leave_proxy_unbound{}); auto _Right_al_non_const = _Right_al; auto _Newhead = _Node::_Buyheadnode(_Right_al_non_const); @@ -1952,7 +1952,7 @@ protected: void _Alloc_sentinel_and_proxy() { const auto _Scary = _Get_scary(); - auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alnode, _Getal()); + auto _Alproxy = _STD _Get_proxy_allocator(_Getal()); _Container_proxy_ptr<_Alnode> _Proxy(_Alproxy, *_Scary); _Scary->_Myhead = _Node::_Buyheadnode(_Getal()); _Proxy._Release(); From 20d8595ab647ba0a3a5a4ac53ec6c99fea85c047 Mon Sep 17 00:00:00 2001 From: "Stephan T. Lavavej" Date: Thu, 8 May 2025 01:23:44 -0700 Subject: [PATCH 2/2] Add `_STD`. --- stl/inc/forward_list | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/stl/inc/forward_list b/stl/inc/forward_list index 8abac81f0c9..24e58cf8306 100644 --- a/stl/inc/forward_list +++ b/stl/inc/forward_list @@ -675,7 +675,7 @@ public: if (_Al != _Right_al) { _Mypair._Myval2._Orphan_all(); clear(); - _Mypair._Myval2._Reload_proxy(_STD _Get_proxy_allocator(_Al), _Get_proxy_allocator(_Right_al)); + _Mypair._Myval2._Reload_proxy(_STD _Get_proxy_allocator(_Al), _STD _Get_proxy_allocator(_Right_al)); _Pocma(_Al, _Right_al); _Take_head(_Right); return *this;