From 09ec83a7400ce14875b3fa5c73e494364b21945a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=93=E8=88=AA?= <1210603696@qq.com> Date: Sat, 20 Sep 2014 09:55:50 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=BA=E7=A9=BA=E9=97=B4=E9=85=8D=E7=BD=AE?= =?UTF-8?q?=E5=99=A8=E5=A2=9E=E5=8A=A0=E9=94=80=E6=AF=81=E4=B8=80=E6=AE=B5?= =?UTF-8?q?=E8=8C=83=E5=9B=B4=E5=86=85=E5=AF=B9=E8=B1=A1=E7=9A=84=E5=87=BD?= =?UTF-8?q?=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TinySTL/Allocator.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/TinySTL/Allocator.h b/TinySTL/Allocator.h index 42caa8a..b12e18c 100644 --- a/TinySTL/Allocator.h +++ b/TinySTL/Allocator.h @@ -31,6 +31,7 @@ namespace TinySTL{ static void construct(T *ptr); static void construct(T *ptr, const T& value); static void destroy(T *ptr); + static void destroy(T *first, T *last); }; template @@ -64,6 +65,12 @@ namespace TinySTL{ void allocator::destroy(T *ptr){ ptr->~T(); } + template + void allocator::destroy(T *first, T *last){ + for (; first != last; ++first){ + first->~T(); + } + } } #endif \ No newline at end of file