mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-28 13:43:45 +03:00
AK: Add adopt_own() to create a NonnullOwnPtr<T> from a T&
This commit is contained in:
parent
ee6472fef2
commit
806d3d8e79
Notes:
sideshowbarker
2024-07-19 08:00:46 +09:00
Author: https://github.com/awesomekling Commit: https://github.com/SerenityOS/serenity/commit/806d3d8e799
@ -167,6 +167,12 @@ private:
|
|||||||
T* m_ptr = nullptr;
|
T* m_ptr = nullptr;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
inline NonnullOwnPtr<T> adopt_own(T& object)
|
||||||
|
{
|
||||||
|
return NonnullOwnPtr<T>(NonnullOwnPtr<T>::Adopt, object);
|
||||||
|
}
|
||||||
|
|
||||||
template<class T, class... Args>
|
template<class T, class... Args>
|
||||||
inline NonnullOwnPtr<T>
|
inline NonnullOwnPtr<T>
|
||||||
make(Args&&... args)
|
make(Args&&... args)
|
||||||
@ -195,5 +201,6 @@ inline void swap(NonnullOwnPtr<T>& a, NonnullOwnPtr<U>& b)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
using AK::adopt_own;
|
||||||
using AK::make;
|
using AK::make;
|
||||||
using AK::NonnullOwnPtr;
|
using AK::NonnullOwnPtr;
|
||||||
|
Loading…
Reference in New Issue
Block a user