mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 05:07:34 +00:00
AK: Add templated NonnullOwnPtr::release_nonnull()
This allows you to release a NonnullOwnPtr<T> into a NonnullOwnPtr<U>
This commit is contained in:
parent
788293ead8
commit
d69fd87b50
1 changed files with 7 additions and 0 deletions
|
@ -155,6 +155,13 @@ public:
|
|||
::swap(m_ptr, other.m_ptr);
|
||||
}
|
||||
|
||||
template<typename U>
|
||||
NonnullOwnPtr<U> release_nonnull()
|
||||
{
|
||||
ASSERT(m_ptr);
|
||||
return NonnullOwnPtr<U>(NonnullOwnPtr<U>::Adopt, static_cast<U&>(*leak_ptr()));
|
||||
}
|
||||
|
||||
private:
|
||||
void clear()
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue