mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 12:07:45 +00:00
AK: Add adopt_own() to create a NonnullOwnPtr<T> from a T&
This commit is contained in:
parent
ee6472fef2
commit
806d3d8e79
1 changed files with 7 additions and 0 deletions
|
@ -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…
Add table
Add a link
Reference in a new issue