@@ -2647,11 +2647,9 @@ private:
26472647 return;
26482648 }
26492649
2650- _My_data._Myres = _BUF_SIZE - 1;
2651- size_type _New_capacity = _Calculate_growth(_Count);
2652- ++_New_capacity;
2653- const pointer _New_ptr = _Allocate_at_least_helper(_Al, _New_capacity); // throws
2654- --_New_capacity;
2650+ _My_data._Myres = _BUF_SIZE - 1;
2651+ const size_type _New_capacity = _Calculate_growth(_Count);
2652+ const pointer _New_ptr = _Al.allocate(_New_capacity + 1); // throws
26552653 _Construct_in_place(_My_data._Bx._Ptr, _New_ptr);
26562654
26572655 _Start_element_lifetimes(_Unfancy(_New_ptr), _New_capacity + 1);
@@ -2693,10 +2691,8 @@ private:
26932691 }
26942692
26952693 if (_Count >= _BUF_SIZE) {
2696- size_type _New_capacity = _Calculate_growth(_Count);
2697- ++_New_capacity;
2698- const pointer _New_ptr = _Allocate_at_least_helper(_Al, _New_capacity); // throws
2699- --_New_capacity;
2694+ const size_type _New_capacity = _Calculate_growth(_Count);
2695+ const pointer _New_ptr = _Al.allocate(_New_capacity + 1); // throws
27002696 _Construct_in_place(_My_data._Bx._Ptr, _New_ptr);
27012697 _My_data._Myres = _New_capacity;
27022698
@@ -2712,11 +2708,9 @@ private:
27122708 _Xlen_string(); // result too long
27132709 }
27142710
2715- const auto _Old_ptr = _My_data._Myptr();
2716- size_type _New_capacity = _Calculate_growth(_My_data._Mysize);
2717- ++_New_capacity;
2718- const pointer _New_ptr = _Allocate_at_least_helper(_Al, _New_capacity); // throws
2719- --_New_capacity;
2711+ const auto _Old_ptr = _My_data._Myptr();
2712+ const size_type _New_capacity = _Calculate_growth(_My_data._Mysize);
2713+ const pointer _New_ptr = _Al.allocate(_New_capacity + 1); // throws
27202714
27212715 _Start_element_lifetimes(_Unfancy(_New_ptr), _New_capacity + 1);
27222716 _Traits::copy(_Unfancy(_New_ptr), _Old_ptr, _My_data._Mysize);
@@ -2798,11 +2792,9 @@ public:
27982792 _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _My_data); // throws
27992793
28002794 if (_New_capacity < _New_size) {
2801- _New_capacity = _Calculate_growth(_New_size, _BUF_SIZE - 1, max_size());
2802- ++_New_capacity;
2803- const pointer _Fancyptr = _Allocate_at_least_helper(_Getal(), _New_capacity); // throws
2804- --_New_capacity;
2805- _Ptr = _Unfancy(_Fancyptr);
2795+ _New_capacity = _Calculate_growth(_New_size, _BUF_SIZE - 1, max_size());
2796+ const pointer _Fancyptr = _Getal().allocate(_New_capacity + 1); // throws
2797+ _Ptr = _Unfancy(_Fancyptr);
28062798 _Construct_in_place(_My_data._Bx._Ptr, _Fancyptr);
28072799
28082800 _Start_element_lifetimes(_Ptr, _New_capacity + 1);
@@ -2871,12 +2863,10 @@ public:
28712863 _Xlen_string();
28722864 }
28732865
2874- auto _New_capacity = _Calculate_growth(_New_size, _BUF_SIZE - 1, _Max);
2875- auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Getal());
2866+ const auto _New_capacity = _Calculate_growth(_New_size, _BUF_SIZE - 1, _Max);
2867+ auto&& _Alproxy = _GET_PROXY_ALLOCATOR(_Alty, _Getal());
28762868 _Container_proxy_ptr<_Alty> _Proxy(_Alproxy, _My_data); // throws
2877- ++_New_capacity;
2878- const pointer _Fancyptr = _Allocate_at_least_helper(_Getal(), _New_capacity); // throws
2879- --_New_capacity;
2869+ const pointer _Fancyptr = _Getal().allocate(_New_capacity + 1); // throws
28802870 // nothrow hereafter
28812871 _Start_element_lifetimes(_Unfancy(_Fancyptr), _New_capacity + 1);
28822872 _Construct_in_place(_My_data._Bx._Ptr, _Fancyptr);
@@ -2956,10 +2946,9 @@ public:
29562946 _Result._Res = _My_data._Myres + 1;
29572947 } else {
29582948 // use _BUF_SIZE + 1 to avoid SSO, if the buffer is assigned back
2959- size_type _Allocated = _BUF_SIZE + 1;
2960- _Result._Ptr = _Allocate_at_least_helper(_Al, _Allocated);
2949+ _Result._Ptr = _Al.allocate(_BUF_SIZE + 1);
29612950 _Traits::copy(_Unfancy(_Result._Ptr), _My_data._Bx._Buf, _BUF_SIZE);
2962- _Result._Res = _Allocated ;
2951+ _Result._Res = _BUF_SIZE + 1 ;
29632952 }
29642953 _My_data._Orphan_all();
29652954 _Tidy_init();
@@ -3178,13 +3167,11 @@ public:
31783167
31793168 if (_Right._Mypair._Myval2._Large_string_engaged()) {
31803169 const auto _New_size = _Right._Mypair._Myval2._Mysize;
3181- auto _New_capacity = _Calculate_growth(_New_size, 0, _Right.max_size());
3170+ const auto _New_capacity = _Calculate_growth(_New_size, 0, _Right.max_size());
31823171 auto _Right_al_non_const = _Right_al;
3183- ++_New_capacity;
3184- const auto _New_ptr = _Allocate_at_least_helper(_Right_al_non_const, _New_capacity); // throws
3185- --_New_capacity;
3172+ const auto _New_ptr = _Right_al_non_const.allocate(_New_capacity + 1); // throws
31863173
3187- _Start_element_lifetimes(_Unfancy(_New_ptr), _New_capacity + 1);
3174+ _Start_element_lifetimes(_Unfancy(_New_ptr), _New_size + 1);
31883175
31893176 _Traits::copy(_Unfancy(_New_ptr), _Unfancy(_Right._Mypair._Myval2._Bx._Ptr), _New_size + 1);
31903177 _Tidy_deallocate();
@@ -4749,11 +4736,9 @@ private:
47494736 }
47504737
47514738 const size_type _Old_capacity = _Mypair._Myval2._Myres;
4752- size_type _New_capacity = _Calculate_growth(_New_size);
4739+ const size_type _New_capacity = _Calculate_growth(_New_size);
47534740 auto& _Al = _Getal();
4754- ++_New_capacity;
4755- const pointer _New_ptr = _Allocate_at_least_helper(_Al, _New_capacity); // throws
4756- --_New_capacity;
4741+ const pointer _New_ptr = _Al.allocate(_New_capacity + 1); // throws
47574742
47584743 _Start_element_lifetimes(_Unfancy(_New_ptr), _New_capacity + 1);
47594744 _Mypair._Myval2._Orphan_all();
@@ -4784,11 +4769,9 @@ private:
47844769
47854770 const size_type _New_size = _Old_size + _Size_increase;
47864771 const size_type _Old_capacity = _My_data._Myres;
4787- size_type _New_capacity = _Calculate_growth(_New_size);
4772+ const size_type _New_capacity = _Calculate_growth(_New_size);
47884773 auto& _Al = _Getal();
4789- ++_New_capacity;
4790- const pointer _New_ptr = _Allocate_at_least_helper(_Al, _New_capacity); // throws
4791- --_New_capacity;
4774+ const pointer _New_ptr = _Al.allocate(_New_capacity + 1); // throws
47924775
47934776 _Start_element_lifetimes(_Unfancy(_New_ptr), _New_capacity + 1);
47944777 _My_data._Orphan_all();
0 commit comments