@@ -16,11 +16,18 @@ namespace hlsl
16
16
namespace impl
17
17
{
18
18
19
+ template<class T, bool C>
20
+ struct is_const_helper : bool_constant<C>
21
+ {
22
+ NBL_CONSTEXPR_STATIC_INLINE bool is_constant = is_const<T>::value;
23
+ };
24
+
19
25
enum e_member_presence
20
26
{
21
27
absent = 0 ,
22
- non_static,
23
- as_static
28
+ non_static = 1 ,
29
+ as_static = 2 ,
30
+ static_constexpr = 3 ,
24
31
};
25
32
26
33
template<class T>
@@ -34,27 +41,23 @@ typedef impl::e_member_presence e_member_presence;
34
41
}
35
42
36
43
37
- #define NBL_GENERATE_MEMBER_TESTER (mem ) \
44
+ #define NBL_GENERATE_MEMBER_TESTER (a ) \
38
45
namespace nbl \
39
46
{ \
40
47
namespace hlsl \
41
48
{ \
42
- namespace impl \
43
- { \
49
+ namespace impl { \
50
+ template<class T, class =void > \
51
+ struct is_static_member_##a: false_type {NBL_CONSTEXPR_STATIC_INLINE bool is_constant = false ; }; \
52
+ template<class T> \
53
+ 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 > {}; \
44
54
template<class T, class =void > \
45
- struct is_static_member_##mem : false_type {}; \
55
+ struct is_member_##a : false_type {NBL_CONSTEXPR_STATIC_INLINE bool is_constant = false ; }; \
46
56
template<class T> \
47
- struct is_static_member_##mem<T,typename enable_if<!is_same<decltype (T::mem),void >::value,void >::type>: true_type{}; \
48
- template<class T, class =void > \
49
- struct is_member_##mem: false_type {}; \
50
- template<class T> \
51
- struct is_member_##mem<T,typename enable_if<!is_same<decltype (impl::declval<T>().mem),void >::value,void >::type>: true_type{}; \
57
+ 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 >{}; \
52
58
} \
53
59
template<class T> \
54
- struct has_member_##mem \
55
- { \
56
- NBL_CONSTEXPR_STATIC_INLINE e_member_presence value = (e_member_presence)(impl::is_member_##mem<T>::value + impl::is_static_member_##mem<T>::value); \
57
- }; \
60
+ 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); }; \
58
61
} \
59
62
}
60
63
0 commit comments