Make more CTL fixes

This commit is contained in:
Justine Tunney 2024-07-01 07:10:35 -07:00
parent 61370983e1
commit d0cd719375
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
4 changed files with 122 additions and 15 deletions

View file

@ -411,16 +411,17 @@ class vector
return erase(pos, pos + 1);
}
iterator erase(const_iterator first, const_iterator last)
constexpr iterator erase(const_iterator first, const_iterator last)
{
difference_type index = first - begin();
difference_type count = last - first;
iterator it = begin() + index;
ctl::move(it + count, end(), it);
for (iterator move_it = it + count; move_it != end(); ++move_it, ++it)
*it = ctl::move(*move_it);
for (difference_type i = 0; i < count; ++i)
ctl::allocator_traits<Allocator>::destroy(alloc_, end() - i - 1);
size_ -= count;
return it;
return begin() + index;
}
void push_back(const T& value)