mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 21:07:36 +00:00
AK: Rename downcast<T> => verify_cast<T>
This makes it much clearer what this cast actually does: it will VERIFY that the thing we're casting is a T (using is<T>()).
This commit is contained in:
parent
6215a9c2cb
commit
ee3a73ddbb
61 changed files with 262 additions and 262 deletions
|
@ -28,7 +28,7 @@ ALWAYS_INLINE bool is(InputType* input)
|
|||
}
|
||||
|
||||
template<typename OutputType, typename InputType>
|
||||
ALWAYS_INLINE CopyConst<InputType, OutputType>* downcast(InputType* input)
|
||||
ALWAYS_INLINE CopyConst<InputType, OutputType>* verify_cast(InputType* input)
|
||||
{
|
||||
static_assert(IsBaseOf<InputType, OutputType>);
|
||||
VERIFY(!input || is<OutputType>(*input));
|
||||
|
@ -36,7 +36,7 @@ ALWAYS_INLINE CopyConst<InputType, OutputType>* downcast(InputType* input)
|
|||
}
|
||||
|
||||
template<typename OutputType, typename InputType>
|
||||
ALWAYS_INLINE CopyConst<InputType, OutputType>& downcast(InputType& input)
|
||||
ALWAYS_INLINE CopyConst<InputType, OutputType>& verify_cast(InputType& input)
|
||||
{
|
||||
static_assert(IsBaseOf<InputType, OutputType>);
|
||||
VERIFY(is<OutputType>(input));
|
||||
|
@ -45,5 +45,5 @@ ALWAYS_INLINE CopyConst<InputType, OutputType>& downcast(InputType& input)
|
|||
|
||||
}
|
||||
|
||||
using AK::downcast;
|
||||
using AK::is;
|
||||
using AK::verify_cast;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue