mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:37:35 +00:00
LibJS: Temporarily disambiguate const-ness of GCPtr constructors
Without this change, using {Nonnull,}GCPtr<T const> would complain that there are multiple constructors which resolve to the same type (T& and T const&). This removes that disambiguation and allows us to slowly fix all of the constness issues surrounding GCPtrs. This change will not be necessary in the future as we will be able to remove all of the const qualifiers from the Ptr classes (they'll be in the template type instead).
This commit is contained in:
parent
a9372de972
commit
17a528c49e
1 changed files with 4 additions and 1 deletions
|
@ -24,6 +24,7 @@ public:
|
|||
}
|
||||
|
||||
NonnullGCPtr(T const& ptr)
|
||||
requires(!IsConst<T>)
|
||||
: m_ptr(&const_cast<T&>(ptr))
|
||||
{
|
||||
}
|
||||
|
@ -37,7 +38,7 @@ public:
|
|||
|
||||
template<typename U>
|
||||
NonnullGCPtr(U const& ptr)
|
||||
requires(IsConvertible<U*, T*>)
|
||||
requires(IsConvertible<U*, T*> && !IsConst<T>)
|
||||
: m_ptr(&const_cast<T&>(static_cast<T const&>(ptr)))
|
||||
{
|
||||
}
|
||||
|
@ -96,6 +97,7 @@ public:
|
|||
}
|
||||
|
||||
GCPtr(T const& ptr)
|
||||
requires(!IsConst<T>)
|
||||
: m_ptr(&const_cast<T&>(ptr))
|
||||
{
|
||||
}
|
||||
|
@ -106,6 +108,7 @@ public:
|
|||
}
|
||||
|
||||
GCPtr(T const* ptr)
|
||||
requires(!IsConst<T>)
|
||||
: m_ptr(const_cast<T*>(ptr))
|
||||
{
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue