Loading...
Searching...
No Matches
HasMemberGeneratorMacros.hpp File Reference

This macro generates a class HasMember_${MEMBER_NAME} which can be used for template specialization. More...

Go to the source code of this file.

## Macros

#define | OPM_GENERATE_HAS_MEMBER(MEMBER_NAME, ...)
| This macro generates a class HasMember_${MEMBER_NAME} which can be used for template specialization.

## Detailed Description

This macro generates a class HasMember_${MEMBER_NAME} which can be used for template specialization.

e.g. if OPM_GENERATE_HAS_MEMBER(foo, int(), int(), int()) has been used, HasMember_foo<T>::value is true (if and only if) t.foo(int(), int(), int()) is a valid expression for an object t of the class T.

## Macro Definition Documentation

## OPM_GENERATE_HAS_MEMBER

#define OPM_GENERATE_HAS_MEMBER | ( |  | MEMBER_NAME,
|  |  | ... )

Value:
template <class T, class T2> \
struct HasMember_##MEMBER_NAME##_Helper \
{ \
static constexpr bool value = false; \
}; \
\
template <class T> \
struct HasMember_##MEMBER_NAME##_Helper<T, \
typename ::Opm::AlwaysVoid<decltype(std::declval<T>().MEMBER_NAME(__VA_ARGS__))>::type> \
{ \
static constexpr bool value = true; \
}; \
\
template<typename T> \
struct HasMember_##MEMBER_NAME \
{ \
static constexpr bool value = HasMember_##MEMBER_NAME##_Helper<T, void>::value; \
};

This macro generates a class HasMember_${MEMBER_NAME} which can be used for template specialization.

e.g. if OPM_GENERATE_HAS_MEMBER(foo, int(), int(), int()) has been used, HasMember_foo<T>::value is true (if and only if) t.foo(int(), int(), int()) is a valid expression for an object t of the class T.