MIRA
Macros
HasNonMember.h File Reference

Macros for checking the existence of non-member functions. More...

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Macros

#define MIRA_NONMEMBER_FUNCTION0_DETECTOR_EX(Identifier, ReturnType, FunctionName)
 
#define MIRA_NONMEMBER_FUNCTION0_DETECTOR(ReturnType, FunctionName)   MIRA_NONMEMBER_FUNCTION0_DETECTOR_EX(FunctionName, ReturnType, FunctionName)
 
#define MIRA_NONMEMBER_FUNCTION1_DETECTOR_EX(Identifier, ReturnType, FunctionName)
 
#define MIRA_NONMEMBER_FUNCTION1_DETECTOR(ReturnType, FunctionName)   MIRA_NONMEMBER_FUNCTION1_DETECTOR_EX(FunctionName, ReturnType, FunctionName)
 
#define MIRA_NONMEMBER_FUNCTION2_DETECTOR_EX(Identifier, ReturnType, FunctionName)
 
#define MIRA_NONMEMBER_FUNCTION2_DETECTOR(ReturnType, FunctionName)   MIRA_NONMEMBER_FUNCTION2_DETECTOR_EX(FunctionName, ReturnType, FunctionName)
 
#define MIRA_NONMEMBER_FUNCTION3_DETECTOR_EX(Identifier, ReturnType, FunctionName)
 
#define MIRA_NONMEMBER_FUNCTION3_DETECTOR(ReturnType, FunctionName)   MIRA_NONMEMBER_FUNCTION3_DETECTOR_EX(FunctionName, ReturnType, FunctionName)
 
#define MIRA_HAS_NONMEMBER_FUNCTION0(Identifier)   MIRAHasNonMemberCheck##Identifier<>
 Macro checking the existence of a free function with no parameters and specific return type. More...
 
#define MIRA_HAS_NONMEMBER_FUNCTION1(Identifier, ParamType0)   MIRAHasNonMemberCheck##Identifier<ParamType0>
 Macro checking the existence of a free function with specific parameter+return types. More...
 
#define MIRA_HAS_NONMEMBER_FUNCTION2(Identifier, ParamType0, ParamType1)   MIRAHasNonMemberCheck##Identifier<ParamType0, ParamType1>
 Macro checking the existence of a free function with specific parameter+return types. More...
 
#define MIRA_HAS_NONMEMBER_FUNCTION3(Identifier, ParamType0, ParamType1, ParamType2)   MIRAHasNonMemberCheck##Identifier<ParamType0, ParamType1, ParamType2>
 Macro checking the existence of a free function with specific parameter+return types. More...
 

Detailed Description

Macros for checking the existence of non-member functions.

Author
Christof Schröter
Date
2021/02/19

Macro Definition Documentation

◆ MIRA_NONMEMBER_FUNCTION0_DETECTOR_EX

#define MIRA_NONMEMBER_FUNCTION0_DETECTOR_EX (   Identifier,
  ReturnType,
  FunctionName 
)
Value:
template <typename = ReturnType> \
struct MIRAHasNonMemberCheck##Identifier \
{ \
typedef std::false_type type; \
enum { value = false }; \
}; \
\
template <> \
struct MIRAHasNonMemberCheck##Identifier<decltype(FunctionName())> \
{ \
typedef std::true_type type; \
enum { value = true }; \
};
PropertyHint type(const std::string &t)
Sets the attribute "type" to the specified value.
Definition: PropertyHint.h:295

◆ MIRA_NONMEMBER_FUNCTION0_DETECTOR

#define MIRA_NONMEMBER_FUNCTION0_DETECTOR (   ReturnType,
  FunctionName 
)    MIRA_NONMEMBER_FUNCTION0_DETECTOR_EX(FunctionName, ReturnType, FunctionName)

◆ MIRA_NONMEMBER_FUNCTION1_DETECTOR_EX

#define MIRA_NONMEMBER_FUNCTION1_DETECTOR_EX (   Identifier,
  ReturnType,
  FunctionName 
)
Value:
template <typename P0, typename = ReturnType> \
struct MIRAHasNonMemberCheck##Identifier \
{ \
typedef std::false_type type; \
enum { value = false }; \
}; \
\
template <typename P0> \
struct MIRAHasNonMemberCheck##Identifier<P0, \
decltype(FunctionName(std::declval<P0>()))> \
{ \
typedef std::true_type type; \
enum { value = true }; \
};
PropertyHint type(const std::string &t)
Sets the attribute "type" to the specified value.
Definition: PropertyHint.h:295

◆ MIRA_NONMEMBER_FUNCTION1_DETECTOR

#define MIRA_NONMEMBER_FUNCTION1_DETECTOR (   ReturnType,
  FunctionName 
)    MIRA_NONMEMBER_FUNCTION1_DETECTOR_EX(FunctionName, ReturnType, FunctionName)

◆ MIRA_NONMEMBER_FUNCTION2_DETECTOR_EX

#define MIRA_NONMEMBER_FUNCTION2_DETECTOR_EX (   Identifier,
  ReturnType,
  FunctionName 
)
Value:
template <typename P0, typename P1, typename = ReturnType> \
struct MIRAHasNonMemberCheck##Identifier \
{ \
typedef std::false_type type; \
enum { value = false }; \
}; \
\
template <typename P0, typename P1> \
struct MIRAHasNonMemberCheck##Identifier<P0, P1, \
decltype(FunctionName(std::declval<P0>(), \
std::declval<P1>()))> \
{ \
typedef std::true_type type; \
enum { value = true }; \
};
PropertyHint type(const std::string &t)
Sets the attribute "type" to the specified value.
Definition: PropertyHint.h:295

◆ MIRA_NONMEMBER_FUNCTION2_DETECTOR

#define MIRA_NONMEMBER_FUNCTION2_DETECTOR (   ReturnType,
  FunctionName 
)    MIRA_NONMEMBER_FUNCTION2_DETECTOR_EX(FunctionName, ReturnType, FunctionName)

◆ MIRA_NONMEMBER_FUNCTION3_DETECTOR_EX

#define MIRA_NONMEMBER_FUNCTION3_DETECTOR_EX (   Identifier,
  ReturnType,
  FunctionName 
)
Value:
template <typename P0, typename P1, typename P2, typename = ReturnType> \
struct MIRAHasNonMemberCheck##Identifier \
{ \
typedef std::false_type type; \
enum { value = false }; \
}; \
\
template <typename P0, typename P1, typename P2> \
struct MIRAHasNonMemberCheck##Identifier<P0, P1, P2, \
decltype(FunctionName(std::declval<P0>(), \
std::declval<P1>(), \
std::declval<P2>()))> \
{ \
typedef std::true_type type; \
enum { value = true }; \
};
PropertyHint type(const std::string &t)
Sets the attribute "type" to the specified value.
Definition: PropertyHint.h:295

◆ MIRA_NONMEMBER_FUNCTION3_DETECTOR

#define MIRA_NONMEMBER_FUNCTION3_DETECTOR (   ReturnType,
  FunctionName 
)    MIRA_NONMEMBER_FUNCTION3_DETECTOR_EX(FunctionName, ReturnType, FunctionName)

◆ MIRA_HAS_NONMEMBER_FUNCTION0

#define MIRA_HAS_NONMEMBER_FUNCTION0 (   Identifier)    MIRAHasNonMemberCheck##Identifier<>

Macro checking the existence of a free function with no parameters and specific return type.

void doSomething();
MIRA_NONMEMBER_FUNCTION_DETECTOR0(void, doSomething)
if (MIRA_HAS_NONMEMBER_FUNCTION0(doSomething)::value) {
...
}

◆ MIRA_HAS_NONMEMBER_FUNCTION1

#define MIRA_HAS_NONMEMBER_FUNCTION1 (   Identifier,
  ParamType0 
)    MIRAHasNonMemberCheck##Identifier<ParamType0>

Macro checking the existence of a free function with specific parameter+return types.

void doSomething(int);
MIRA_NONMEMBER_FUNCTION_DETECTOR1(void, doSomething)
if (MIRA_HAS_NONMEMBER_FUNCTION1(doSomething, int)::value) {
...
}

◆ MIRA_HAS_NONMEMBER_FUNCTION2

#define MIRA_HAS_NONMEMBER_FUNCTION2 (   Identifier,
  ParamType0,
  ParamType1 
)    MIRAHasNonMemberCheck##Identifier<ParamType0, ParamType1>

Macro checking the existence of a free function with specific parameter+return types.

void doSomething(int, bool);
MIRA_NONMEMBER_FUNCTION_DETECTOR2(void, doSomething)
if (MIRA_HAS_NONMEMBER_FUNCTION2(doSomething, int, bool)::value) {
...
}

◆ MIRA_HAS_NONMEMBER_FUNCTION3

#define MIRA_HAS_NONMEMBER_FUNCTION3 (   Identifier,
  ParamType0,
  ParamType1,
  ParamType2 
)    MIRAHasNonMemberCheck##Identifier<ParamType0, ParamType1, ParamType2>

Macro checking the existence of a free function with specific parameter+return types.

void doSomething(int, bool, float);
MIRA_NONMEMBER_FUNCTION_DETECTOR3(void, doSomething)
if (MIRA_HAS_NONMEMBER_FUNCTION3(doSomething, int, bool, float)::value) {
...
}