|
Go to the documentation of this file.
10 #ifndef ADOBE_TYPE_INSPECTION_HPP
11 #define ADOBE_TYPE_INSPECTION_HPP
37 #define ADOBE_HAS_TYPE_IMPL(TypeInQuestion) \
39 typename C##TypeInQuestion> \
40 struct has_type##TypeInQuestion \
42 template <typename T##TypeInQuestion> \
43 static adobe::detail::yes_struct SFINAE(typename T##TypeInQuestion::TypeInQuestion*); \
45 static adobe::detail::no_struct SFINAE(...); \
46 static const bool value = sizeof(SFINAE<C##TypeInQuestion>(0)) == sizeof(adobe::detail::yes_struct); \
65 #define ADOBE_HAS_TYPE(C, TypeInQuestion) \
66 has_type##TypeInQuestion<C>::value
83 template < typename T, typename Default>
86 template < bool condition, typename IFtype, typename ELSEtype>
89 typedef typename IFtype::type type;
91 template < typename IFtype, typename ELSEtype>
117 #define ADOBE_HAS_MEMBER_IMPL(Member) \
118 template <class Class> \
119 struct has_member##Member \
121 __if_exists(Class::Member) \
123 static const bool value = true; \
125 __if_not_exists(Class::Member) \
127 static const bool value = false; \
135 struct member_test_helper
140 #define ADOBE_HAS_MEMBER_IMPL(MemberInQuestion) \
141 template <class Class> \
142 struct has_member##MemberInQuestion \
144 template <class T##MemberInQuestion> \
145 static adobe::detail::yes_struct SFINAE( adobe::detail::member_test_helper<sizeof(&T##MemberInQuestion::MemberInQuestion)> * ); \
147 static adobe::detail::no_struct SFINAE(...); \
148 static const bool value = sizeof(SFINAE<Class>(0)) == sizeof(adobe::detail::yes_struct); \
168 #define ADOBE_HAS_MEMBER(C, MemberInQuestion) \
169 has_member##MemberInQuestion<C>::value
184 #define ADOBE_HAS_TEMPLATE1_IMPL(TemplateInQuestion) \
186 typename C##TemplateInQuestion> \
187 struct has_template1##TemplateInQuestion \
189 template <typename T##TemplateInQuestion> \
190 static adobe::detail::yes_struct SFINAE(typename T##TemplateInQuestion::template TemplateInQuestion<int>*); \
191 template <typename> \
192 static adobe::detail::no_struct SFINAE(...); \
193 static const bool value = sizeof(SFINAE<C##TemplateInQuestion>(0)) == sizeof(adobe::detail::yes_struct); \
217 #define ADOBE_HAS_TEMPLATE1(C, TemplateInQuestion) \
218 has_template1##TemplateInQuestion<C>::value
224 #define ADOBE_HAS_TEMPLATE2_IMPL(TemplateInQuestion) \
226 typename C##TemplateInQuestion> \
227 struct has_template2##TemplateInQuestion \
229 template <typename T##TemplateInQuestion> \
230 static adobe::detail::yes_struct SFINAE(typename T##TemplateInQuestion::template TemplateInQuestion<int, int>*); \
231 template <typename> \
232 static adobe::detail::no_struct SFINAE(...); \
233 static const bool value = sizeof(SFINAE<C##TemplateInQuestion>(0)) == sizeof(adobe::detail::yes_struct); \
236 #define ADOBE_HAS_TEMPLATE2(C, TemplateInQuestion) \
237 has_template2##TemplateInQuestion<C>::value
239 #define ADOBE_HAS_TEMPLATE3_IMPL(TemplateInQuestion) \
241 typename C##TemplateInQuestion> \
242 struct has_template3##TemplateInQuestion \
244 template <typename T##TemplateInQuestion> \
245 static adobe::detail::yes_struct SFINAE(typename T##TemplateInQuestion::template TemplateInQuestion<int, int, int>*); \
246 template <typename> \
247 static adobe::detail::no_struct SFINAE(...); \
248 static const bool value = sizeof(SFINAE<C##TemplateInQuestion>(0)) == sizeof(adobe::detail::yes_struct); \
251 #define ADOBE_HAS_TEMPLATE3(C, TemplateInQuestion) \
252 has_template3##TemplateInQuestion<C>::value
257 #endif // include guard
|