diff options
author | rtk0c <[email protected]> | 2022-06-02 21:34:16 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2022-06-02 21:34:16 -0700 |
commit | bd07ae3f4e1bcdedc3e373460671ca9713a03de5 (patch) | |
tree | 15c897891474a97983f247196923f8e4f2184083 /source/10-common/TypeTraits.hpp | |
parent | 8a0f2cd0b398ee0b7740e44a0e5fb2f75d090ccb (diff) |
Changeset: 60 Add struct/class scanning to codegen
Diffstat (limited to 'source/10-common/TypeTraits.hpp')
-rw-r--r-- | source/10-common/TypeTraits.hpp | 24 |
1 files changed, 16 insertions, 8 deletions
diff --git a/source/10-common/TypeTraits.hpp b/source/10-common/TypeTraits.hpp index cca9a1f..73a56f9 100644 --- a/source/10-common/TypeTraits.hpp +++ b/source/10-common/TypeTraits.hpp @@ -1,19 +1,27 @@ #pragma once -template <class T> +#include <cstddef> + +/// This template will be instanciated for each unique type, and the char variable will be ODR-used which gives it an unique address. +template <typename T> +struct TypeIdentifier { + static const char obj = 0; +}; + +template <typename T> struct DefaultDeleter { - void operator()(T* ptr) const { - delete ptr; - } + void operator()(T* ptr) const { + delete ptr; + } }; -template <class> +template <typename> struct RemoveMemberPtrImpl {}; -template <class T, class U> +template <typename T, typename U> struct RemoveMemberPtrImpl<U T::*> { - using Type = U; + using Type = U; }; -template <class T> +template <typename T> using RemoveMemberPtr = typename RemoveMemberPtrImpl<T>::Type; |