mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2024-11-22 07:30:19 +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: https://github.com/SerenityOS/serenity/commit/bad8ab697b6
1 changed files with 4 additions and 2 deletions
|
@ -74,14 +74,16 @@ public:
|
|||
}
|
||||
RETURN_TYPESTATE(unconsumed)
|
||||
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>
|
||||
RETURN_TYPESTATE(unconsumed)
|
||||
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()
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue