1
Fork 0
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:
Andreas Kling 2019-01-12 07:22:25 +01:00
parent b7d83e3265
commit 8068b8e09e
2 changed files with 15 additions and 3 deletions

View file

@ -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) {