fix some small bug in clear

This commit is contained in:
2024-02-26 00:36:39 +00:00
parent 847a48dcda
commit 918e838c1b

View File

@ -360,14 +360,14 @@ class vector {
void clear() {
if (raw_beg != nullptr) {
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);
}
raw_beg = alloc.allocate(1);
raw_end = raw_beg;
allocated_length = 1;
current_length = 0;
}
/**
* inserts value before pos