1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 12:37:44 +00:00

AK: Optimize Vector::append(Vector&&) for case where this->m_impl is null.

This commit is contained in:
Andreas Kling 2019-02-07 09:08:59 +01:00
parent 443d1c2237
commit 44e1a45b2a

View file

@ -172,6 +172,10 @@ public:
void append(Vector<T>&& other) void append(Vector<T>&& other)
{ {
if (!m_impl) {
m_impl = move(other.m_impl);
return;
}
Vector<T> tmp = move(other); Vector<T> tmp = move(other);
ensure_capacity(size() + tmp.size()); ensure_capacity(size() + tmp.size());
for (auto&& v : tmp) { for (auto&& v : tmp) {