解决分配0字节空间时的问题
This commit is contained in:
@@ -40,7 +40,7 @@ namespace TinySTL{
|
|||||||
}
|
}
|
||||||
template<class T>
|
template<class T>
|
||||||
T *allocator<T>::allocate(size_t n){
|
T *allocator<T>::allocate(size_t n){
|
||||||
assert(n != 0);
|
if (n == 0) return 0;
|
||||||
return static_cast<T *>(alloc::allocate(sizeof(T) * n));
|
return static_cast<T *>(alloc::allocate(sizeof(T) * n));
|
||||||
}
|
}
|
||||||
template<class T>
|
template<class T>
|
||||||
|
|||||||
Reference in New Issue
Block a user