no more leaks in vector
This commit is contained in:
@@ -52,7 +52,12 @@ VT_TPL VT::
|
||||
}
|
||||
// destructors -------------------------------
|
||||
VT_TPL VT::
|
||||
~vector() { return; }
|
||||
~vector() {
|
||||
|
||||
clear();
|
||||
_allocator.deallocate(_mem_ptr, _capacity);
|
||||
return;
|
||||
}
|
||||
// operator= ---------------------------------
|
||||
VT_TPL VT & VT::
|
||||
operator=( vector const & rhs ) {
|
||||
@@ -152,15 +157,14 @@ VT_TPL void VT::
|
||||
_capacity = new_cap;
|
||||
tmp_ptr = _allocator.allocate(new_cap);
|
||||
|
||||
_mem_ptr = tmp_ptr;
|
||||
if (_mem_ptr)
|
||||
{
|
||||
_mem_ptr = tmp_ptr;
|
||||
_size = 0;
|
||||
assign(first, last);
|
||||
_destroy(begin(), end());
|
||||
_allocator.deallocate(old_ptr, _capacity);
|
||||
}
|
||||
_mem_ptr = tmp_ptr;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user