AK: Reorder access in FixedArray so that m_size comes before m_elements

This commit is contained in:
creator1creeper1 2022-01-08 21:10:58 +01:00 committed by Linus Groh
parent 3c05261611
commit 18a2685c6a

View file

@ -79,8 +79,8 @@ public:
for (size_t i = 0; i < m_size; ++i)
m_elements[i].~T();
kfree_sized(m_elements, sizeof(T) * m_size);
m_elements = nullptr;
m_size = 0;
m_elements = nullptr;
}
size_t size() const { return m_size; }
@ -110,8 +110,8 @@ public:
void swap(FixedArray<T>& other)
{
::swap(m_elements, other.m_elements);
::swap(m_size, other.m_size);
::swap(m_elements, other.m_elements);
}
using ConstIterator = SimpleIterator<FixedArray const, T const>;