解决分配0字节空间时的问题

This commit is contained in:
邹晓航
2014-10-13 10:09:10 +08:00
parent 047f6ce937
commit 80f84a910d

View File

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