mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 10:57: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>
|
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*>())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue