@@ -17,19 +17,11 @@ namespace hlsl
17
17
namespace impl
18
18
{
19
19
20
- template<class T, bool C>
21
- struct is_const_helper : bool_constant<C>
22
- {
23
- using type = T;
24
- NBL_CONSTEXPR_STATIC_INLINE bool is_constant = is_const<T>::value;
25
- };
26
-
27
20
enum e_member_presence
28
21
{
29
- absent = 0 ,
30
- non_static = 1 ,
31
- as_static = 2 ,
32
- static_constexpr = 3 ,
22
+ is_present = 1 <<0 ,
23
+ is_static = 1 <<1 ,
24
+ is_const = 1 <<2 ,
33
25
};
34
26
35
27
template<class T>
@@ -55,16 +47,16 @@ namespace hlsl \
55
47
{ \
56
48
namespace impl { \
57
49
template<class T, class =void > \
58
- struct is_static_member_##a: false_type {NBL_CONSTEXPR_STATIC_INLINE bool is_constant = false ; }; \
50
+ struct is_static_member_##a: false_type { }; \
59
51
template<class T> \
60
- struct is_static_member_##a<T,typename enable_if<!is_same<decltype (T::a),void >::value,void >::type>: is_const_helper< decltype (T::a), true > { }; \
52
+ struct is_static_member_##a<T,typename enable_if<!is_same<decltype (T::a),void >::value,void >::type> : true_type { }; \
61
53
template<class T, class =void > \
62
- struct is_member_##a: false_type {NBL_CONSTEXPR_STATIC_INLINE bool is_constant = false ; using type = void ; }; \
54
+ struct is_member_##a: false_type { using type = void ; }; \
63
55
template<class T> \
64
- struct is_member_##a<T,typename enable_if<!is_same<decltype (declval<T>().a),void >::value,void >::type> : is_const_helper< decltype (declval<T>().a), true >{ }; \
56
+ struct is_member_##a<T,typename enable_if<!is_same<decltype (declval<T>().a),void >::value,void >::type> : true_type { using type = decltype (declval<T>().a); }; \
65
57
} \
66
58
template<class T> \
67
- struct has_member_##a { NBL_CONSTEXPR_STATIC_INLINE e_member_presence value = (e_member_presence)(impl::is_member_##a<T>::value + impl::is_static_member_##a<T>::value + impl::is_static_member_ ##a<T>::is_constant ); }; \
59
+ struct has_member_##a { NBL_CONSTEXPR_STATIC_INLINE e_member_presence value = (e_member_presence)(impl::is_member_##a<T>::value + 2 * impl::is_static_member_##a<T>::value + 4 *is_const<typename impl::is_member_ ##a<T>::type>::value ); }; \
68
60
template<class T, class F> struct has_member_##a##_with_type : bool_constant<has_member_##a<T>::value && is_same<typename impl::is_member_##a<T>::type, F>::value> {}; \
69
61
} \
70
62
}
0 commit comments