AK: Explicitly make MaybeOwned noncopyable

Copying an owning MaybeOwned is forbidden.
This commit is contained in:
kleines Filmröllchen 2023-05-25 00:12:44 +02:00 committed by Jelle Raaijmakers
parent 75c61172e3
commit 7a6b1f179b
Notes: sideshowbarker 2024-07-16 18:06:42 +09:00

View file

@ -13,6 +13,8 @@ namespace AK {
template<typename T>
class MaybeOwned {
AK_MAKE_NONCOPYABLE(MaybeOwned);
public:
template<DerivedFrom<T> U>
MaybeOwned(NonnullOwnPtr<U> handle)
@ -27,6 +29,9 @@ public:
{
}
MaybeOwned(MaybeOwned&&) = default;
MaybeOwned& operator=(MaybeOwned&&) = default;
T* ptr()
{
if (m_handle.template has<T*>())