29 #ifndef VC_TRAITS_IS_IMPLICIT_CAST_ALLOWED_H_
30 #define VC_TRAITS_IS_IMPLICIT_CAST_ALLOWED_H_
32 namespace Vc_VERSIONED_NAMESPACE
36 template <typename From, typename To, bool = std::is_integral<From>::value>
37 struct is_implicit_cast_allowed
38 :
public std::integral_constant<
39 bool, std::is_same<From, To>::value ||
40 (std::is_integral<To>::value &&
41 (std::is_same<typename std::make_unsigned<From>::type, To>::value ||
42 std::is_same<typename std::make_signed<From>::type, To>::value))> {
45 template <
typename From,
typename To>
46 struct is_implicit_cast_allowed<From, To, false> :
public std::is_same<From, To>::type {
49 template <
typename From,
typename To>
50 struct is_implicit_cast_allowed_mask :
public is_implicit_cast_allowed<From, To> {
53 static_assert(is_implicit_cast_allowed<float, float>::value,
"");
54 static_assert(!is_implicit_cast_allowed<float, double>::value,
"");
55 static_assert(is_implicit_cast_allowed< int64_t, uint64_t>::value,
"");
56 static_assert(is_implicit_cast_allowed<uint64_t, int64_t>::value,
"");
57 static_assert(is_implicit_cast_allowed< int32_t, uint32_t>::value,
"");
58 static_assert(is_implicit_cast_allowed<uint32_t, int32_t>::value,
"");
59 static_assert(is_implicit_cast_allowed< int16_t, uint16_t>::value,
"");
60 static_assert(is_implicit_cast_allowed<uint16_t, int16_t>::value,
"");
61 static_assert(is_implicit_cast_allowed< int8_t, uint8_t>::value,
"");
62 static_assert(is_implicit_cast_allowed< uint8_t, int8_t>::value,
"");
67 #endif // VC_TRAITS_IS_IMPLICIT_CAST_ALLOWED_H_