AK: Explain why FixedArray has no move assignment

This commit is contained in:
kleines Filmröllchen 2022-01-13 10:50:31 +01:00 committed by Linus Groh
parent 594bbbf020
commit 068aea660c
Notes: sideshowbarker 2024-07-18 22:57:59 +09:00

View file

@ -55,7 +55,7 @@ public:
return MUST(try_clone()); return MUST(try_clone());
} }
// NOTE: Nobody can ever use these functions, since it would be impossible to make them OOM-safe due to their signatures. We just explicitly delete them. // Nobody can ever use these functions, since it would be impossible to make them OOM-safe due to their signatures. We just explicitly delete them.
FixedArray(FixedArray<T> const&) = delete; FixedArray(FixedArray<T> const&) = delete;
FixedArray<T>& operator=(FixedArray<T> const&) = delete; FixedArray<T>& operator=(FixedArray<T> const&) = delete;
@ -66,7 +66,7 @@ public:
other.m_size = 0; other.m_size = 0;
other.m_elements = nullptr; other.m_elements = nullptr;
} }
// NOTE: Nobody uses this function, so we just explicitly delete it. // 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>&&) = delete;
~FixedArray() ~FixedArray()