Skip to content

Commit

Permalink
D. _Growmap should not use _Allocate_at_least_helper; (consider w…
Browse files Browse the repository at this point in the history
…hat will happen if `_Allocate_at_least_helper` modified `_Newsize`); restore to the old version
  • Loading branch information
achabense committed Sep 8, 2023
1 parent 8e18127 commit 779b76a
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions stl/inc/deque
Original file line number Diff line number Diff line change
Expand Up @@ -1518,13 +1518,12 @@ private:

_Newsize *= 2;
}
_Count = _Newsize - _Mapsize();

size_type _Myboff = _Myoff() / _Block_size;
_Mapptr _Newmap = _Allocate_at_least_helper(_Almap, _Newsize);
_Mapptr _Newmap = _Almap.allocate(_Mapsize() + _Count);
_Mapptr _Myptr = _Newmap + _Myboff;

_Count = _Newsize - _Mapsize();

_Myptr = _STD uninitialized_copy(_Map() + _Myboff, _Map() + _Mapsize(), _Myptr); // copy initial to end
if (_Myboff <= _Count) { // increment greater than offset of initial block
_Myptr = _STD uninitialized_copy(_Map(), _Map() + _Myboff, _Myptr); // copy rest of old
Expand Down

0 comments on commit 779b76a

Please sign in to comment.