From bd07ae3f4e1bcdedc3e373460671ca9713a03de5 Mon Sep 17 00:00:00 2001 From: rtk0c Date: Thu, 2 Jun 2022 21:34:16 -0700 Subject: Changeset: 60 Add struct/class scanning to codegen --- source/10-common/TypeTraits.hpp | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) (limited to 'source/10-common/TypeTraits.hpp') diff --git a/source/10-common/TypeTraits.hpp b/source/10-common/TypeTraits.hpp index cca9a1f..73a56f9 100644 --- a/source/10-common/TypeTraits.hpp +++ b/source/10-common/TypeTraits.hpp @@ -1,19 +1,27 @@ #pragma once -template +#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; - } + void operator()(T* ptr) const { + delete ptr; + } }; -template +template struct RemoveMemberPtrImpl {}; -template +template struct RemoveMemberPtrImpl { - using Type = U; + using Type = U; }; -template +template using RemoveMemberPtr = typename RemoveMemberPtrImpl::Type; -- cgit v1.2.3-70-g09d2