mirror of
https://github.com/zebrajr/ladybird.git
synced 2025-12-06 12:20:00 +01:00
LibWeb: Ensure static cast is used when possible in as_if
This commit is contained in:
parent
5e6b8b2785
commit
4e57a2aedf
|
|
@ -40,11 +40,10 @@ ALWAYS_INLINE CopyConst<InputType, OutputType>* as_if(InputType& input)
|
|||
{
|
||||
if (!is<OutputType>(input))
|
||||
return nullptr;
|
||||
if constexpr (IsBaseOf<InputType, OutputType>) {
|
||||
if constexpr (requires { static_cast<CopyConst<InputType, OutputType>*>(&input); }) {
|
||||
return static_cast<CopyConst<InputType, OutputType>*>(&input);
|
||||
} else {
|
||||
return dynamic_cast<CopyConst<InputType, OutputType>*>(&input);
|
||||
}
|
||||
return dynamic_cast<CopyConst<InputType, OutputType>*>(&input);
|
||||
}
|
||||
|
||||
template<typename OutputType, typename InputType>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user