n == 0时不回收内存
This commit is contained in:
@@ -49,7 +49,7 @@ namespace TinySTL{
|
|||||||
}
|
}
|
||||||
template<class T>
|
template<class T>
|
||||||
void allocator<T>::deallocate(T *ptr, size_t n){
|
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);
|
alloc::deallocate(static_cast<void *>(ptr), sizeof(T)* n);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user