diff options
author | rtk0c <[email protected]> | 2022-06-03 23:30:01 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2022-06-03 23:30:01 -0700 |
commit | 791b3f354b378769bffe623b05f1305c91b77101 (patch) | |
tree | 5409b311e6232eb4a6d3f8259b780d76b8ee1c59 /ProjectBrussel/Common/TypeTraits.hpp | |
parent | 60ccc62f4934e44ad5b905fdbcf458302b8d8a09 (diff) |
Changeset: 64 [WIP] Rename directoriesmaster-switch-to-build2
Diffstat (limited to 'ProjectBrussel/Common/TypeTraits.hpp')
-rw-r--r-- | ProjectBrussel/Common/TypeTraits.hpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/ProjectBrussel/Common/TypeTraits.hpp b/ProjectBrussel/Common/TypeTraits.hpp new file mode 100644 index 0000000..73a56f9 --- /dev/null +++ b/ProjectBrussel/Common/TypeTraits.hpp @@ -0,0 +1,27 @@ +#pragma once + +#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; + } +}; + +template <typename> +struct RemoveMemberPtrImpl {}; + +template <typename T, typename U> +struct RemoveMemberPtrImpl<U T::*> { + using Type = U; +}; + +template <typename T> +using RemoveMemberPtr = typename RemoveMemberPtrImpl<T>::Type; |