29#define ONIXS_CMEMDH_CHECK_TYPE_INTEGRAL(Type) \
30 static_assert(std::is_integral<Type>::value, #Type " must be an integral type, consider adding MemberTraits");
34struct IsTriviallyCopyable
36 :
std::integral_constant<bool, __has_trivial_copy(T) && __has_trivial_assign(T) && __has_trivial_destructor(T)>
38 :
std::is_trivially_copyable<T>
45struct IsTriviallyDefaultConstructible
47 :
std::integral_constant<bool, __has_trivial_constructor(T)>
49 :
std::is_trivially_default_constructible<T>
57 template <
class T,
class U>
58 struct IsSameSignedness
60 enum { value = (
static_cast<bool>(std::is_signed<T>::value) ==
static_cast<bool>(std::is_signed<U>::value)) };
67 template<
typename U>
struct SFINAE {};
69 template<
typename U>
static int test(...);
70 enum { value =
sizeof(test<T>(
nullptr)) ==
sizeof(
char) };
77 template<
typename U>
struct SFINAE {};
79 template<
typename U>
static int test(...);
80 enum { value =
sizeof(test<T>(
nullptr)) ==
sizeof(
char) };
87 enum { value = HasMantissa<T>::value && HasExponent<T>::value };
96 struct AreBothDecimals
98 enum { value = IsDecimal<Decimal1>::value && IsDecimal<Decimal2>::value };
103 struct HasMemberTraits
107 template<
typename U>
static int test(...);
108 enum { value =
sizeof(test<T>(
nullptr)) ==
sizeof(
char) };
113 struct HasValueStaticMember
115 template<
typename U,
typename U::Value (*)()>
struct SFINAE {};
117 template<
typename U>
static int test(...);
118 enum { value =
sizeof(test<T>(
nullptr)) ==
sizeof(
char) };
123 struct HasSerializeMember
125 template<
typename U,
void (U::*)(
void*) const noexcept>
struct SFINAE {};
127 template<
typename U>
static int test(...);
128 enum { value =
sizeof(test<T>(
nullptr)) ==
sizeof(
char) };
133template <
class To,
class From>
135typename std::enable_if<details::IsSameSignedness<To, From>::value, To>::type
136 numericCast(From from)
noexcept
138 const auto to =
static_cast<To
>(from);
140 assert(
static_cast<From
>(to) == from);
146template <
class To,
class From>
148typename std::enable_if<!details::IsSameSignedness<To, From>::value, To>::type
149 numericCast(From from)
noexcept
151 const auto to =
static_cast<To
>(from);
153 assert(
static_cast<From
>(to) == from);
156 assert((to >
static_cast<To
>(0)) == (from >
static_cast<From
>(0)));
#define ONIXS_CMEMDH_MESSAGING_NAMESPACE_BEGIN
#define ONIXS_CMEMDH_MESSAGING_NAMESPACE_END
#define ONIXS_CMEMDH_FORCEINLINE
#define ONIXS_CMEMDH_CXX14