aboutsummaryrefslogtreecommitdiff
path: root/source/10-common/TypeTraits.hpp
diff options
context:
space:
mode:
authorrtk0c <[email protected]>2023-09-20 23:58:58 -0700
committerrtk0c <[email protected]>2023-09-20 23:58:58 -0700
commitf138311d2d2e0cc9ba0496d523bb46f2c1c9fb73 (patch)
treef96100a813a4ffb28dcd074455d3a2f8ee426430 /source/10-common/TypeTraits.hpp
Copy from the PlasticSCM repo, replace vendored glm wtih conan
Diffstat (limited to 'source/10-common/TypeTraits.hpp')
-rw-r--r--source/10-common/TypeTraits.hpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/source/10-common/TypeTraits.hpp b/source/10-common/TypeTraits.hpp
new file mode 100644
index 0000000..73a56f9
--- /dev/null
+++ b/source/10-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;