From b7fc59cf12cd1d01fdfd7b7500b77ff861dc8de3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=93=E8=88=AA?= <1210603696@qq.com> Date: Wed, 22 Oct 2014 19:15:29 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=87=8D=E5=88=86=E9=85=8D?= =?UTF-8?q?=E7=AE=97=E6=B3=95=EF=BC=8C=E5=A4=A7=E5=B9=85=E6=8F=90=E9=AB=98?= =?UTF-8?q?=E5=89=8D=E6=8F=92=E7=9A=84=E6=95=88=E7=8E=87?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TinySTL/Deque.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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];