mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-09 17:49:40 +00:00
NonnullRefPtr: Simplify copy constructors.
This commit is contained in:
parent
2dd54f062a
commit
bad8ab697b
Notes:
sideshowbarker
2024-07-19 13:29:47 +09:00
Author: https://github.com/awesomekling
Commit: bad8ab697b
1 changed files with 4 additions and 2 deletions
|
@ -74,14 +74,16 @@ public:
|
||||||
}
|
}
|
||||||
RETURN_TYPESTATE(unconsumed)
|
RETURN_TYPESTATE(unconsumed)
|
||||||
NonnullRefPtr(const NonnullRefPtr& other)
|
NonnullRefPtr(const NonnullRefPtr& other)
|
||||||
: m_ptr(&const_cast<NonnullRefPtr&>(other).copy_ref().leak_ref())
|
: m_ptr(const_cast<T*>(other.ptr()))
|
||||||
{
|
{
|
||||||
|
m_ptr->ref();
|
||||||
}
|
}
|
||||||
template<typename U>
|
template<typename U>
|
||||||
RETURN_TYPESTATE(unconsumed)
|
RETURN_TYPESTATE(unconsumed)
|
||||||
NonnullRefPtr(const NonnullRefPtr<U>& other)
|
NonnullRefPtr(const NonnullRefPtr<U>& other)
|
||||||
: m_ptr(&const_cast<NonnullRefPtr<U>&>(other).copy_ref().leak_ref())
|
: m_ptr(const_cast<T*>(static_cast<const T*>((other.ptr()))))
|
||||||
{
|
{
|
||||||
|
m_ptr->ref();
|
||||||
}
|
}
|
||||||
~NonnullRefPtr()
|
~NonnullRefPtr()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue