mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 05:47:35 +00:00
NonnullRefPtr: Simplify copy constructors.
This commit is contained in:
parent
2dd54f062a
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