diff --git a/src/ruc/meta/types.h b/src/ruc/meta/types.h new file mode 100644 index 0000000..d342710 --- /dev/null +++ b/src/ruc/meta/types.h @@ -0,0 +1,25 @@ +/* + * Copyright (C) 2023 Riyyi + * + * SPDX-License-Identifier: MIT + */ + +#pragma once + +#include + +template +inline bool is(U& input) +{ + if constexpr (requires { input.template fastIs(); }) { + return input.template fastIs(); + } + + return typeid(input) == typeid(T); +} + +template +inline bool is(U* input) +{ + return input && is(*input); +}