11 #ifndef __SYS_TYPEDECORATE_H_INCLUDED__
12 #define __SYS_TYPEDECORATE_H_INCLUDED__
23 template<
typename T >
26 template<
typename T >
29 template<
typename T >
32 template<
typename T >
35 template<
typename T >
84 template<
typename T >
struct SYS_HasCV {
static constexpr
bool value =
false; };
88 template<
typename T >
struct SYS_HasCV< const
T > {
static constexpr
bool value =
true; };
89 template<
typename T >
struct SYS_HasCV< volatile
T > {
static constexpr
bool value =
true; };
90 template<
typename T >
struct SYS_HasCV< const volatile
T > {
static constexpr
bool value =
true; };
97 #define SYS_DECLARE_IS_INTEGRAL(T) \
98 template<> struct AddIntegralNoCV< T > { \
99 static_assert( ( ! SYS_HasCV_v< T > ), \
100 "SYS_DECLARE_IS_INTEGRAL must be used on types without const/volatile qualifiers" ); \
101 [[maybe_unused]] static constexpr bool value = true; \
106 #define SYS_DECLARE_IS_FLOATING_POINT(T) \
107 template<> struct AddFloatingPointNoCV< T > { \
108 static_assert( ( ! SYS_HasCV_v< T > ), \
109 "SYS_DECLARE_IS_FLOATING_POINT must be used on types without const/volatile qualifiers" ); \
110 [[maybe_unused]] static constexpr bool value = true; \
115 #define SYS_DECLARE_IS_POD(T) \
116 template<> struct AddPodNoCV< T > { \
117 static_assert( ( ! SYS_HasCV_v< T > ), \
118 "SYS_DECLARE_IS_POD must be used on types without const/volatile qualifiers" ); \
119 [[maybe_unused]] static constexpr bool value = true; \
123 #define SYS_DECLARE_IS_TR_IMPL(...) \
124 struct SafeTrivialRelocationNoCV< __VA_ARGS__ > { \
125 static_assert( ( ! SYS_HasCV_v< __VA_ARGS__> ), \
126 "SYS_DECLARE_IS_TR must be used on types without const/volatile qualifiers" ); \
127 [[maybe_unused]] static constexpr bool value = true; \
131 #define SYS_DECLARE_IS_NOT_TR_IMPL(...) \
132 struct UnsafeTrivialRelocationNoCV< __VA_ARGS__ > { \
133 static_assert( ( ! SYS_HasCV_v< __VA_ARGS__ > ), \
134 "SYS_DECLARE_IS_NOT_TR must be used on types without const/volatile qualifiers" ); \
135 [[maybe_unused]] static constexpr bool value = true; \
139 #define SYS_DECLARE_LEGACY_TR_IMPL(...) \
140 struct LegacyTrivialRelocationNoCV< __VA_ARGS__ > { \
141 static_assert( ( ! SYS_HasCV_v< __VA_ARGS__ > ), \
142 "SYS_DECLARE_LEGACY_TR must be used on types without const/volatile qualifiers" ); \
143 [[maybe_unused]] static constexpr bool value = true; \
147 #define SYS_REGISTER_TR_IMPL(...) \
148 struct RegisterTrivialRelocationNoCV< __VA_ARGS__ > { \
149 static_assert( ( ! SYS_HasCV_v< __VA_ARGS__ > ), \
150 "SYS_REGISTER_TR must be used on types without const/volatile qualifiers" ); \
151 [[maybe_unused]] static constexpr bool value = true; \
156 #define SYS_DECLARE_IS_TR(T) template<> SYS_DECLARE_IS_TR_IMPL(T)
159 #define SYS_DECLARE_IS_TR_TEMPLATE(...) SYS_DECLARE_IS_TR_IMPL( __VA_ARGS__ )
162 #define SYS_DECLARE_IS_NOT_TR(T) template<> SYS_DECLARE_IS_NOT_TR_IMPL(T)
165 #define SYS_DECLARE_IS_NOT_TR_TEMPLATE(...) SYS_DECLARE_IS_NOT_TR_IMPL( __VA_ARGS__ )
171 #define SYS_DECLARE_LEGACY_TR(T) template<> SYS_DECLARE_LEGACY_TR_IMPL(T)
174 #define SYS_DECLARE_LEGACY_TR_TEMPLATE(...) SYS_DECLARE_LEGACY_TR_IMPL( __VA_ARGS__ )
184 #define SYS_REGISTER_TR(T) template<> SYS_REGISTER_TR_IMPL(T)
187 #define SYS_REGISTER_TR_TEMPLATE(...) SYS_REGISTER_TR_IMPL( __VA_ARGS__ )
211 template<
typename T >
217 #endif // __SYS_TYPEDECORATE_H_INCLUDED__
typename SYS_RemoveCV< T >::type SYS_RemoveCV_t
constexpr auto SYS_HasCV_v
#define SYS_DECLARE_IS_TR(T)
Guarantee that it's safe to use trivial relocation with type T.