From 80f84a910df74106d5153c03182719399c90f2c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=93=E8=88=AA?= <1210603696@qq.com> Date: Mon, 13 Oct 2014 10:09:10 +0800 Subject: [PATCH] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E5=88=86=E9=85=8D0=E5=AD=97?= =?UTF-8?q?=E8=8A=82=E7=A9=BA=E9=97=B4=E6=97=B6=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TinySTL/Allocator.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/TinySTL/Allocator.h b/TinySTL/Allocator.h index 68d9d25..a394553 100644 --- a/TinySTL/Allocator.h +++ b/TinySTL/Allocator.h @@ -40,7 +40,7 @@ namespace TinySTL{ } template T *allocator::allocate(size_t n){ - assert(n != 0); + if (n == 0) return 0; return static_cast(alloc::allocate(sizeof(T) * n)); } template