diff options
author | rtk0c <[email protected]> | 2023-10-19 22:50:07 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2025-08-16 11:31:16 -0700 |
commit | 297232d21594b138bb368a42b5b0d085ff9ed6aa (patch) | |
tree | 075d5407e1e12a9d35cbee6e4c20ad34e0765c42 /source/10-common/RTTI.hpp | |
parent | d5cd34ff69f7fd134d5450696f298af1a864afbc (diff) |
The great renaming: switch to "module style"
Diffstat (limited to 'source/10-common/RTTI.hpp')
-rw-r--r-- | source/10-common/RTTI.hpp | 44 |
1 files changed, 0 insertions, 44 deletions
diff --git a/source/10-common/RTTI.hpp b/source/10-common/RTTI.hpp deleted file mode 100644 index bd9475b..0000000 --- a/source/10-common/RTTI.hpp +++ /dev/null @@ -1,44 +0,0 @@ -#pragma once - -#include <cassert> - -template <typename T, typename TBase> -bool is_a(TBase* t) { - assert(t != nullptr); - return T::IsInstance(t); -} - -template <typename T, typename TBase> -bool is_a_nullable(TBase* t) { - if (t) { - return is_a<T, TBase>(t); - } else { - return false; - } -} - -template <typename T, typename TBase> -T* dyn_cast(TBase* t) { - assert(t != nullptr); - if (T::IsInstance(t)) { - return static_cast<T*>(t); - } else { - return nullptr; - } -} - -template <typename T, typename TBase> -const T* dyn_cast(const TBase* t) { - assert(t != nullptr); - if (T::IsInstance(t)) { - return static_cast<const T*>(t); - } else { - return nullptr; - } -} - -template <typename T, typename TBase> -T* dyn_cast_nullable(TBase* t) { - if (!t) return nullptr; - return dyn_cast<T, TBase>(t); -} |