n == 0时不回收内存

This commit is contained in:
邹晓航
2014-09-24 16:36:50 +08:00
parent 3e54fa5144
commit 98045a102c

View File

@@ -49,7 +49,7 @@ namespace TinySTL{
}
template<class T>
void allocator<T>::deallocate(T *ptr, size_t n){
assert(n != 0);
if (n == 0) return;
alloc::deallocate(static_cast<void *>(ptr), sizeof(T)* n);
}