27 #ifdef ONIXS_B3_UMDF_MD_HAS_TYPE_TRAITS 28 # include <type_traits> 33 #ifdef ONIXS_B3_UMDF_MD_HAS_TYPE_TRAITS 36 template <
bool B,
class T =
void>
37 using EnableIf = std::enable_if<B, T>;
40 template <
typename Base,
typename Derived>
41 using IsBaseOf = std::is_base_of<Base, Derived>;
45 using IsSigned = std::is_signed<T>;
47 #define CHECK_TYPE_INTEGRAL(Type) \ 49 std::is_integral<Type>::value, \ 50 #Type " must be an integral type, consider adding MemberTraits" \ 55 template <
bool B,
class T =
void>
63 struct EnableIf<false, T> {};
66 template<
typename Base,
typename Derived>
69 enum { value = __is_base_of(Base, Derived)};
76 enum { value = (!(
static_cast<T
>(-1) > static_cast<T>(0))) };
79 #define CHECK_TYPE_INTEGRAL(Type) 87 template <
class T,
class U>
88 struct IsSameSignedness
90 enum { value = (
static_cast<bool>(IsSigned<T>::value) == static_cast<bool>(IsSigned<U>::value)) };
97 template<
typename U>
struct SFINAE {};
99 template<
typename U>
static int test(...);
109 template<
typename U>
static int test(...);
120 enum { value = HasMantissa<T>::value && HasExponent<T>::value };
129 struct AreBothDecimals
131 enum { value = IsDecimal<Decimal1>::value && IsDecimal<Decimal2>::value };
136 struct HasMemberTraits
140 template<
typename U>
static int test(...);
146 struct HasValueStaticMember
148 template<
typename U,
typename U::Value (*)()>
struct SFINAE {};
150 template<
typename U>
static int test(...);
156 struct HasSerializeMember
158 template<
typename U,
void (U::*)(
void*) const ONIXS_B3_UMDF_MD_NOTHROW>
struct SFINAE {};
160 template<
typename U>
static int test(...);
170 template<
typename U>
static int test(...);
176 template <
typename Set,
typename NullValue>
177 typename EnableIf<details::HasBitsMember<Set>::value,
bool>::type
183 return set.bits() != null;
187 template <
class To,
class From>
188 ONIXS_B3_UMDF_MD_PURE
190 typename EnableIf<details::IsSameSignedness<To, From>::value, To>::type
194 static_cast<To
>(from);
196 assert(static_cast<From>(to) == from);
202 template <
class To,
class From>
203 ONIXS_B3_UMDF_MD_PURE
205 typename EnableIf<!details::IsSameSignedness<To, From>::value, To>::type
209 static_cast<To
>(from);
211 assert(static_cast<From>(to) == from);
214 assert((to > static_cast<To>(0)) == (from > static_cast<From>(0)));
#define ONIXS_B3_UMDF_MD_NOTHROW
#define ONIXS_B3_UMDF_MD_NULLPTR
#define ONIXS_B3_UMDF_MD_STATIC_ASSERT(X)
#define ONIXS_B3_UMDF_MD_MESSAGING_NAMESPACE_END
#define ONIXS_B3_UMDF_MD_MESSAGING_NAMESPACE_BEGIN