From 2c92e07f337e42cf58970443f9de678f85a9b2a4 Mon Sep 17 00:00:00 2001 From: rtk0c Date: Thu, 19 Oct 2023 22:50:07 -0700 Subject: The great renaming: switch to "module style" --- src/brussel.common/TypeTraits.hpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/brussel.common/TypeTraits.hpp (limited to 'src/brussel.common/TypeTraits.hpp') 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 + +/// This template will be instanciated for each unique type, and the char variable will be ODR-used which gives it an unique address. +template +struct TypeIdentifier { + static const char obj = 0; +}; + +template +struct DefaultDeleter { + void operator()(T* ptr) const { + delete ptr; + } +}; + +template +struct RemoveMemberPtrImpl {}; + +template +struct RemoveMemberPtrImpl { + using Type = U; +}; + +template +using RemoveMemberPtr = typename RemoveMemberPtrImpl::Type; -- cgit v1.2.3-70-g09d2