@@ -26,27 +26,12 @@ struct FalseValue {
26
26
static constexpr bool Value = false ;
27
27
};
28
28
29
- template <typename Type> struct IsIntegral : public FalseValue {};
30
- template <> struct IsIntegral <char > : public TrueValue {};
31
- template <> struct IsIntegral <signed char > : public TrueValue {};
32
- template <> struct IsIntegral <unsigned char > : public TrueValue {};
33
- template <> struct IsIntegral <short > : public TrueValue {};
34
- template <> struct IsIntegral <unsigned short > : public TrueValue {};
35
- template <> struct IsIntegral <int > : public TrueValue {};
36
- template <> struct IsIntegral <unsigned int > : public TrueValue {};
37
- template <> struct IsIntegral <long > : public TrueValue {};
38
- template <> struct IsIntegral <unsigned long > : public TrueValue {};
39
- template <> struct IsIntegral <long long > : public TrueValue {};
40
- template <> struct IsIntegral <unsigned long long > : public TrueValue {};
41
- template <> struct IsIntegral <bool > : public TrueValue {};
42
-
43
- template <typename T> struct IsPointerType : public FalseValue {};
44
- template <typename T> struct IsPointerType <T *> : public TrueValue {};
29
+ template <typename T> struct TypeIdentity { typedef T Type; };
45
30
46
31
template <typename T1, typename T2> struct IsSame : public FalseValue {};
47
32
template <typename T> struct IsSame <T, T> : public TrueValue {};
48
-
49
- template < typename T> struct TypeIdentity { typedef T Type; } ;
33
+ template < typename T1, typename T2>
34
+ static constexpr bool IsSameV = IsSame<T1, T2>::Value ;
50
35
51
36
template <typename T> struct RemoveCV : public TypeIdentity <T> {};
52
37
template <typename T> struct RemoveCV <const T> : public TypeIdentity<T> {};
@@ -56,10 +41,28 @@ struct RemoveCV<const volatile T> : public TypeIdentity<T> {};
56
41
57
42
template <typename T> using RemoveCVType = typename RemoveCV<T>::Type;
58
43
44
+ template <typename Type> struct IsIntegral {
45
+ using TypeNoCV = RemoveCVType<Type>;
46
+ static constexpr bool Value =
47
+ IsSameV<char , TypeNoCV> || IsSameV<signed char , TypeNoCV> ||
48
+ IsSameV<unsigned char , TypeNoCV> || IsSameV<short , TypeNoCV> ||
49
+ IsSameV<unsigned short , TypeNoCV> || IsSameV<int , TypeNoCV> ||
50
+ IsSameV<unsigned int , TypeNoCV> || IsSameV<long , TypeNoCV> ||
51
+ IsSameV<unsigned long , TypeNoCV> || IsSameV<long long , TypeNoCV> ||
52
+ IsSameV<unsigned long long , TypeNoCV> || IsSameV<bool , TypeNoCV>;
53
+ };
54
+
55
+ template <typename T> struct IsPointerTypeNoCV : public FalseValue {};
56
+ template <typename T> struct IsPointerTypeNoCV <T *> : public TrueValue {};
57
+ template <typename T> struct IsPointerType {
58
+ static constexpr bool Value = IsPointerTypeNoCV<RemoveCVType<T>>::Value;
59
+ };
60
+
59
61
template <typename Type> struct IsFloatingPointType {
60
- static constexpr bool Value = IsSame<float , RemoveCVType<Type>>::Value ||
61
- IsSame<double , RemoveCVType<Type>>::Value ||
62
- IsSame<long double , RemoveCVType<Type>>::Value;
62
+ using TypeNoCV = RemoveCVType<Type>;
63
+ static constexpr bool Value = IsSame<float , TypeNoCV>::Value ||
64
+ IsSame<double , TypeNoCV>::Value ||
65
+ IsSame<long double , TypeNoCV>::Value;
63
66
};
64
67
65
68
} // namespace cpp
0 commit comments