mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:47:35 +00:00
AK: Explicitly make MaybeOwned noncopyable
Copying an owning MaybeOwned is forbidden.
This commit is contained in:
parent
75c61172e3
commit
7a6b1f179b
1 changed files with 5 additions and 0 deletions
|
@ -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*>())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue