mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-08 01:00:05 +00:00
AK: Explicitly make MaybeOwned noncopyable
Copying an owning MaybeOwned is forbidden.
This commit is contained in:
parent
75c61172e3
commit
7a6b1f179b
Notes:
sideshowbarker
2024-07-16 18:06:42 +09:00
Author: https://github.com/kleinesfilmroellchen
Commit: 7a6b1f179b
Pull-request: https://github.com/SerenityOS/serenity/pull/19031
Reviewed-by: https://github.com/gmta ✅
Reviewed-by: https://github.com/nico ✅
Reviewed-by: https://github.com/timschumi ✅
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