From 791b3f354b378769bffe623b05f1305c91b77101 Mon Sep 17 00:00:00 2001 From: rtk0c Date: Fri, 3 Jun 2022 23:30:01 -0700 Subject: Changeset: 64 [WIP] Rename directories --- ProjectBrussel/Common/TypeTraits.hpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 ProjectBrussel/Common/TypeTraits.hpp (limited to 'ProjectBrussel/Common/TypeTraits.hpp') 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 + +/// 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