MADARA  3.2.3
SupportTest.h
Go to the documentation of this file.
1 #ifndef INCL_MADARA_UTILITY_SUPPORT_TEST_H
2 #define INCL_MADARA_UTILITY_SUPPORT_TEST_H
3 
11 #include <type_traits>
12 #include <initializer_list>
13 
22 #define MADARA_MAKE_SUPPORT_TEST(name, var, expr) template <typename T> \
23 struct supports_##name##_impl { \
24  template<typename U> static auto test(U *var) -> decltype((expr), std::true_type()); \
25  template<typename U> static auto test(...) -> std::false_type; \
26  using type = decltype(test<T>(0)); \
27 }; \
28 template <typename T> struct supports_##name : supports_##name##_impl<T>::type {}
29 
38 #define MADARA_MAKE_VAL_SUPPORT_TEST(name, var, expr) template <typename T> \
39 struct supports_##name##_impl { \
40  template<typename U> static auto test(U var) -> decltype((expr), std::true_type()); \
41  template<typename U> static auto test(...) -> std::false_type; \
42  using type = decltype(test<T>(std::declval<T>())); \
43 }; \
44 template <typename T> struct supports_##name : supports_##name##_impl<T>::type {}
45 
46 #endif