diff --git a/TinySTL/Deque.h b/TinySTL/Deque.h index cd22457..838108f 100644 --- a/TinySTL/Deque.h +++ b/TinySTL/Deque.h @@ -264,7 +264,7 @@ namespace TinySTL{ void deque::reallocateAndCopy(){ auto newMapSize = getNewMapSize(mapSize_); T** newMap = getANewMap(newMapSize); - size_t startIndex = (newMapSize < 5) ? 1 : 2; + size_t startIndex = newMapSize / 4; for (int i = 0; i + beg_.mapIndex_ != mapSize_; ++i) for (int j = 0; j != getBuckSize(); ++j) newMap[startIndex + i][j] = map_[beg_.mapIndex_ + i][j];