mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 21:47:46 +00:00
Add a Vector::clear_with_capacity() that doesn't release the backing store.
Use this for WindowManager's dirty rects to avoid kmalloc traffic.
This commit is contained in:
parent
b7d83e3265
commit
8068b8e09e
2 changed files with 15 additions and 3 deletions
|
@ -100,6 +100,15 @@ public:
|
|||
m_impl = nullptr;
|
||||
}
|
||||
|
||||
void clear_with_capacity()
|
||||
{
|
||||
if (!m_impl)
|
||||
return;
|
||||
for (size_t i = 0; i < size(); ++i)
|
||||
at(i).~T();
|
||||
m_impl->m_size = 0;
|
||||
}
|
||||
|
||||
bool contains_slow(const T& value) const
|
||||
{
|
||||
for (size_t i = 0; i < size(); ++i) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue