27 #ifdef ONIXS_ILINK3_HAS_TYPE_TRAITS 28 # include <type_traits> 33 #ifdef ONIXS_ILINK3_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(...);
117 enum { value = HasMantissa<T>::value && HasExponent<T>::value };
126 struct AreBothDecimals
128 enum { value = IsDecimal<Decimal1>::value && IsDecimal<Decimal2>::value };
133 struct HasMemberTraits
137 template<
typename U>
static int test(...);
143 struct HasValueStaticMember
145 template<
typename U,
typename U::Value (*)()>
struct SFINAE {};
147 template<
typename U>
static int test(...);
153 struct HasSerializeMember
155 template<
typename U,
void (U::*)(
void*) const ONIXS_ILINK3_NOTHROW>
struct SFINAE {};
157 template<
typename U>
static int test(...);
163 template <
class To,
class From>
166 typename EnableIf<details::IsSameSignedness<To, From>::value, To>::type
170 static_cast<To
>(from);
172 assert(static_cast<From>(to) == from);
178 template <
class To,
class From>
181 typename EnableIf<!details::IsSameSignedness<To, From>::value, To>::type
185 static_cast<To
>(from);
187 assert(static_cast<From>(to) == from);
190 assert((to > static_cast<To>(0)) == (from > static_cast<From>(0)));
#define ONIXS_ILINK3_NULLPTR
#define ONIXS_ILINK3_PURE
#define ONIXS_ILINK3_MESSAGING_NAMESPACE_END
#define ONIXS_ILINK3_MESSAGING_NAMESPACE_BEGIN
#define ONIXS_ILINK3_NOTHROW