From 0313b51ffb9552cc01b4041939b9f8f73c5ade79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=82=B9=E6=99=93=E8=88=AA?= <1210603696@qq.com> Date: Fri, 19 Sep 2014 08:29:03 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=9D=9E0=E6=96=AD=E8=A8=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- TinySTL/Allocator.h | 3 +++ TinySTL/TinySTL.vcxproj | 1 + TinySTL/TinySTL.vcxproj.filters | 3 +++ 3 files changed, 7 insertions(+) diff --git a/TinySTL/Allocator.h b/TinySTL/Allocator.h index 0e70378..42caa8a 100644 --- a/TinySTL/Allocator.h +++ b/TinySTL/Allocator.h @@ -4,6 +4,7 @@ #include "Alloc.h" #include "Construct.h" +#include #include namespace TinySTL{ @@ -38,6 +39,7 @@ namespace TinySTL{ } template T *allocator::allocate(size_t n){ + assert(n != 0); return static_cast(alloc::allocate(sizeof(T) * n)); } template @@ -46,6 +48,7 @@ namespace TinySTL{ } template void allocator::deallocate(T *ptr, size_t n){ + assert(n != 0); alloc::deallocate(static_cast(ptr), sizeof(T)* n); } diff --git a/TinySTL/TinySTL.vcxproj b/TinySTL/TinySTL.vcxproj index 0be76d6..39e827c 100644 --- a/TinySTL/TinySTL.vcxproj +++ b/TinySTL/TinySTL.vcxproj @@ -83,6 +83,7 @@ + diff --git a/TinySTL/TinySTL.vcxproj.filters b/TinySTL/TinySTL.vcxproj.filters index ee4eeb0..657d1f1 100644 --- a/TinySTL/TinySTL.vcxproj.filters +++ b/TinySTL/TinySTL.vcxproj.filters @@ -32,5 +32,8 @@ 头文件 + + 头文件 + \ No newline at end of file