fix some small bug in clear
This commit is contained in:
@ -360,14 +360,14 @@ class vector {
|
|||||||
void clear() {
|
void clear() {
|
||||||
if (raw_beg != nullptr) {
|
if (raw_beg != nullptr) {
|
||||||
for (size_t i = 0; i < current_length; ++i) {
|
for (size_t i = 0; i < current_length; ++i) {
|
||||||
alloc.destroy(raw_beg + i);
|
std::allocator_traits<decltype(alloc)>::destroy(alloc, raw_beg + i);
|
||||||
}
|
}
|
||||||
current_length = 0;
|
|
||||||
alloc.deallocate(raw_beg, allocated_length);
|
alloc.deallocate(raw_beg, allocated_length);
|
||||||
}
|
}
|
||||||
raw_beg = alloc.allocate(1);
|
raw_beg = alloc.allocate(1);
|
||||||
raw_end = raw_beg;
|
raw_end = raw_beg;
|
||||||
allocated_length = 1;
|
allocated_length = 1;
|
||||||
|
current_length = 0;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* inserts value before pos
|
* inserts value before pos
|
||||||
|
Reference in New Issue
Block a user