You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
28 lines
470 B
28 lines
470 B
/* |
|
* Copyright (C) 2023 Riyyi |
|
* |
|
* SPDX-License-Identifier: MIT |
|
*/ |
|
|
|
#pragma once |
|
|
|
#include <typeinfo> |
|
|
|
template<typename T, typename U> |
|
inline bool is(U& input) |
|
{ |
|
if constexpr (requires { input.template fastIs<T>(); }) { |
|
return input.template fastIs<T>(); |
|
} |
|
|
|
return typeid(input) == typeid(T); |
|
} |
|
|
|
template<typename T, typename U> |
|
inline bool is(U* input) |
|
{ |
|
return input && is<T>(*input); |
|
} |
|
|
|
// serenity/AK/TypeCasts.h |
|
// serenity/Userland/Libraries/LibJS/AST.h
|
|
|