LiteFX 0.3.1.2022
Computer Graphics Engine
traits.hpp
1#pragma once
2
3#include <type_traits>
4#include <typeindex>
5#include <concepts>
6
7namespace LiteFX::rtti {
8
12 template <class, class = std::void_t<>>
13 struct has_builder_t : std::false_type { };
14
18 template<class T>
19 struct has_builder_t<T, std::void_t<typename T::builder>> : std::true_type { };
20
34 template <class T>
36
40 template <class T>
41 concept has_builder = has_builder_v<T>;
42
49 template <typename T, typename TArg, typename ...TArgs>
50 struct is_explicitly_constructible_t : std::bool_constant<std::is_constructible_v<T, TArg, TArgs...> && !std::is_convertible_v<TArg, T>> { };
51
58 template <typename T, typename TArg, typename ...TArgs>
59 constexpr bool is_explicitly_constructible_v = is_explicitly_constructible_t<T, TArg, TArgs...>::value;
60
64 template <typename T, typename TArg, typename ...TArgs>
66
73 template <typename T, typename TArg, typename ...TArgs>
74 struct is_implicitly_constructible_t : std::bool_constant<std::is_constructible_v<T, TArg, TArgs...> && std::is_convertible_v<TArg, T>> { };
75
82 template <typename T, typename TArg, typename ...TArgs>
83 constexpr bool is_implicitly_constructible_v = is_explicitly_constructible_t<T, TArg, TArgs...>::value;
84
88 template <typename T, typename TArg, typename ...TArgs>
90
94 template <typename TDerived, typename TBase>
95 concept implements = !std::is_abstract_v<TDerived> && std::derived_from<TDerived, TBase>;
96}
Definition: traits.hpp:41
Definition: traits.hpp:95
Definition: traits.hpp:7
constexpr bool is_explicitly_constructible_v
Evalues to true or false, depending if T contains an explicit constructor that takes TArg and TArgs...
Definition: traits.hpp:59
constexpr bool has_builder_v
Evaluates to either true or false, if T contains an builder member definition.
Definition: traits.hpp:35
constexpr bool is_implicitly_constructible_v
Evalues to true or false, depending if T contains an implicit constructor that takes TArg and TArgs...
Definition: traits.hpp:83
Trait that is evaluated, if a class does not have an builder member type defined.
Definition: traits.hpp:13