xerus
a general purpose tensor library
sfinae.h File Reference

Header file for macros that encapsulate SFINAE functionality. More...

#include <type_traits>

Go to the source code of this file.

Macros

#define XERUS_ADD_MOVE(newTypeName, ...)   class newTypeName, typename std::enable_if<std::is_base_of<__VA_ARGS__, typename std::decay<newTypeName>::type>::value, int>::type = 0
 Adds a template arguments whithin an existing template argument list, which can be of only one specified class, but allows & and && types. More...
 
#define XERUS_GENERATE_HAS_MEMBER(member)
 Macro to create a template class that checks for the existence of member functions. To be used in other template definitions in a SFINAE fashion. More...
 

Detailed Description

Header file for macros that encapsulate SFINAE functionality.

Definition in file sfinae.h.

Macro Definition Documentation

◆ XERUS_ADD_MOVE

#define XERUS_ADD_MOVE (   newTypeName,
  ... 
)    class newTypeName, typename std::enable_if<std::is_base_of<__VA_ARGS__, typename std::decay<newTypeName>::type>::value, int>::type = 0

Adds a template arguments whithin an existing template argument list, which can be of only one specified class, but allows & and && types.

Definition at line 33 of file sfinae.h.

◆ XERUS_GENERATE_HAS_MEMBER

#define XERUS_GENERATE_HAS_MEMBER (   member)
Value:
\
template < class T > \
class HasMember_##member \
{ \
public: \
typedef char (& yes)[1]; \
typedef char (& no)[2]; \
\
template <typename C> static yes check(decltype(&C::member)); \
template <typename> static no check(...); \
\
static constexpr bool RESULT = sizeof(check<T>(0)) == sizeof(yes); \
}; \
\
template < class T > \
struct has_member_##member \
: public std::integral_constant<bool, HasMember_##member<T>::RESULT> \
{ }; \

Macro to create a template class that checks for the existence of member functions. To be used in other template definitions in a SFINAE fashion.

Definition at line 68 of file sfinae.h.