1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 11:57:35 +00:00

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

View file

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