diff options
author | rtk0c <[email protected]> | 2023-10-19 22:50:07 -0700 |
---|---|---|
committer | rtk0c <[email protected]> | 2023-10-19 22:50:07 -0700 |
commit | 2c92e07f337e42cf58970443f9de678f85a9b2a4 (patch) | |
tree | 075d5407e1e12a9d35cbee6e4c20ad34e0765c42 /src/brussel.common/TypeTraits.hpp | |
parent | 615809c036f604bce4582cea8ad49c64693f4f45 (diff) |
The great renaming: switch to "module style"
Diffstat (limited to 'src/brussel.common/TypeTraits.hpp')
-rw-r--r-- | src/brussel.common/TypeTraits.hpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/brussel.common/TypeTraits.hpp b/src/brussel.common/TypeTraits.hpp new file mode 100644 index 0000000..73a56f9 --- /dev/null +++ b/src/brussel.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; |