AK: Make FixedArray movable

This commit is contained in:
Lucas CHOLLET 2023-06-20 13:25:48 -04:00 committed by Andrew Kaster
parent 77d7f715e3
commit f79165cefe
Notes: sideshowbarker 2024-07-16 19:57:55 +09:00

View file

@ -89,8 +89,13 @@ public:
: m_storage(exchange(other.m_storage, nullptr)) : m_storage(exchange(other.m_storage, nullptr))
{ {
} }
// This function would violate the contract, as it would need to deallocate this FixedArray. As it also has no use case, we delete it.
FixedArray<T>& operator=(FixedArray<T>&&) = delete; FixedArray<T>& operator=(FixedArray<T>&& other)
{
m_storage = other.m_storage;
other.m_storage = nullptr;
return *this;
}
~FixedArray() ~FixedArray()
{ {