20 #ifndef HEDGEHOG_TRAITS_H 21 #define HEDGEHOG_TRAITS_H 23 #include <type_traits> 25 #include <string_view> 27 #if defined( __GLIBCXX__ ) || defined( __GLIBCPP__ ) 34 #ifndef DOXYGEN_SHOULD_SKIP_THIS 39 #endif //DOXYGEN_SHOULD_SKIP_THIS 47 inline constexpr
auto isUnique = std::true_type{};
52 template<
typename T,
typename... Rest>
53 inline constexpr
auto isUnique<T, Rest...> =
54 std::bool_constant<(!std::is_same_v<T, Rest> && ...) && isUnique<Rest...>>{};
58 template<
class PossibleManagedMemory>
60 constexpr
static bool const value =
61 std::is_base_of_v<MemoryData<PossibleManagedMemory>, PossibleManagedMemory>
62 && std::is_default_constructible_v<PossibleManagedMemory>;
69 template<
class PossibleManagedMemory>
76 template<
class T,
class... Ts>
78 constexpr
static bool value = std::disjunction_v<std::is_same<T, Ts>...>;
84 template<
class T,
class... Ts>
90 template<
class T,
class... Ts>
97 template<
class T1,
class T2,
class Is>
104 template<
class T1,
class T2, std::size_t... Is>
107 value = std::disjunction_v<Contains<typename std::tuple_element<Is, T1>::type, T2>...>;
114 template<
class T1,
class T2>
120 template<
class T1,
class T2>
128 std::string_view name, prefix, suffix;
130 name = __PRETTY_FUNCTION__;
131 prefix =
"auto hh::traits::type_name() [T = ";
133 #elif defined(__GNUC__) 134 name = __PRETTY_FUNCTION__;
135 prefix =
"constexpr auto hh::traits::type_name() [with T = ";
137 #elif defined(_MSC_VER) 139 prefix =
"auto __cdecl hh::traits::type_name<";
142 name.remove_suffix(suffix.size());
143 name.remove_prefix(prefix.size());
148 #endif //HEDGEHOG_TRAITS_H static constexpr bool const value
True if PossibleManagedMemory can be handled by an AbstractMemoryManager, else False.
constexpr auto isUnique
Check if all parameters in a parameters pack are unique, default case.
Check if a template T is in Template pack Ts.
Test correctness of type given to a memory manager.
Check if a tuple of types T1 is included in a tuple of type T2, all type in T1 are in T2...
constexpr bool Contains_v
Direct Contains value accessor.
constexpr bool is_included_v
Value accessor to test if the types of tuple T1 are in types of tuple T2.
constexpr auto type_name()
Create a std::string_view containing a full type name of T.
constexpr bool is_managed_memory_v
Direct IsManagedMemory value accessor.