MADARA  3.2.3
SupportTest.h File Reference
#include <type_traits>
#include <initializer_list>

Go to the source code of this file.

Macros

#define MADARA_MAKE_SUPPORT_TEST(name, var, expr)
 Macro which generates feature testing traits, to allow enabling features based on what a given type supports. More...
 
#define MADARA_MAKE_VAL_SUPPORT_TEST(name, var, expr)
 Macro which generates feature testing traits, to allow enabling features based on what a given type supports. More...
 

Detailed Description

Author
David Kyle dskyl.nosp@m.e@se.nosp@m.i.cmu.nosp@m..edu

Provides MADARA_MAKE_SUPPORT_TEST macro

Definition in file SupportTest.h.

Macro Definition Documentation

#define MADARA_MAKE_SUPPORT_TEST (   name,
  var,
  expr 
)
Value:
template <typename T> \
struct supports_##name##_impl { \
template<typename U> static auto test(U *var) -> decltype((expr), std::true_type()); \
template<typename U> static auto test(...) -> std::false_type; \
using type = decltype(test<T>(0)); \
}; \
template <typename T> struct supports_##name : supports_##name##_impl<T>::type {}

Macro which generates feature testing traits, to allow enabling features based on what a given type supports.

The tests provide ::value member which is true if the given expr can compile correctly with the given type; false otherwise

var is a pointer to the type being tested

Definition at line 22 of file SupportTest.h.

#define MADARA_MAKE_VAL_SUPPORT_TEST (   name,
  var,
  expr 
)
Value:
template <typename T> \
struct supports_##name##_impl { \
template<typename U> static auto test(U var) -> decltype((expr), std::true_type()); \
template<typename U> static auto test(...) -> std::false_type; \
using type = decltype(test<T>(std::declval<T>())); \
}; \
template <typename T> struct supports_##name : supports_##name##_impl<T>::type {}

Macro which generates feature testing traits, to allow enabling features based on what a given type supports.

The tests provide ::value member which is true if the given expr can compile correctly with the given type; false otherwise

var is a value of the type being tested

Definition at line 38 of file SupportTest.h.