mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-12-03 04:50:29 +00: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
1 changed files with 7 additions and 0 deletions
|
@ -167,6 +167,12 @@ private:
|
|||
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>
|
||||
inline NonnullOwnPtr<T>
|
||||
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::NonnullOwnPtr;
|
||||
|
|
Loading…
Reference in a new issue