提交 4ee7718e 编写于 作者: Z zouxiaohang

shrink_to_fit bug fix

上级 b728798d
......@@ -226,7 +226,12 @@ namespace TinySTL{
}
template<class T, class Alloc>
void vector<T, Alloc>::shrink_to_fit(){
dataAllocator::deallocate(finish_, endOfStorage_ - finish_);
//dataAllocator::deallocate(finish_, endOfStorage_ - finish_);
//endOfStorage_ = finish_;
T* t = (T*)dataAllocator::allocate(size());
finish_ = TinySTL::uninitialized_copy(start_, finish_, t);
dataAllocator::deallocate(start_, capacity());
start_ = t;
endOfStorage_ = finish_;
}
template<class T, class Alloc>
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册