Preprocessor Boolean Metaprogramming module
This module provides various macros for metaprogramming with conditionals and boolean logic
Defines
- #define TRUE
- Macro for logical
true, used to clarify intent over using1 - #define FALSE
- Macro for logical
false, used to clarify intent over using0 - #define V_TRUE(...)
- Macro for consuming a variadic argument pack and converting it to
true - #define V_FALSE(...)
- Macro for consuming a variadic argument pack and converting it to
false - #define IF_ELSE(condition, true_case, false_case)
- Macro for performing if-else conditional branch in the preprocessor Evaluates condition, and if it is
TRUE, preprocessing resolves to the token stringtrue_case. Otherwise, processing resolves to the token stringfalse_case - #define IF(condition, true_case)
- Macro for performing and if conditional branch in the preprocessor Evaluates condition, and if it is
TRUE, preprocessing resolves to the token stringtrue_case. Otherwise, processing resolves to no tokens. - #define NOT(x)
- Macro for performing logical not (e.g.
!) in the preprocessor Evaluatesx, and if it isTRUE, preprocessing resolves toFALSEOtherwise, processing resolves toTRUE - #define OR(x, y)
- Macro for performing logical or (e.g.
||) in the preprocessor Evaluatesxandy, and if either areTRUE, preprocessing resolves toTRUE. Otherwise, preprocessing resolves toFALSE - #define AND(x, y)
- Macro for performing logical and (e.g.
&&) in the preprocessor Evaluatesxandy, and if both areTRUE, preprocessing resolves toTRUE. Otherwise, preprocessing resolves toFALSE
Define documentation
#define TRUE
#include <include/Cnx/mpl/PPBool.h>
Macro for logical true, used to clarify intent over using 1
#define FALSE
#include <include/Cnx/mpl/PPBool.h>
Macro for logical false, used to clarify intent over using 0
#define V_TRUE(...)
#include <include/Cnx/mpl/PPBool.h>
Macro for consuming a variadic argument pack and converting it to true
#define V_FALSE(...)
#include <include/Cnx/mpl/PPBool.h>
Macro for consuming a variadic argument pack and converting it to false
#define IF_ELSE(condition,
true_case,
false_case)
#include <include/Cnx/mpl/PPBool.h>
Macro for performing if-else conditional branch in the preprocessor Evaluates condition, and if it is TRUE, preprocessing resolves to the token string true_case. Otherwise, processing resolves to the token string false_case
| Parameters | |
|---|---|
| condition | - The boolean condition to evaluate. Must evaluate to 0 (FALSE) or 1 (TRUE) in the preprocessor |
| true_case | - The token string to evaluate to in the TRUE case |
| false_case | - The token string to evaluate to in the FALSE case |
#define IF(condition,
true_case)
#include <include/Cnx/mpl/PPBool.h>
Macro for performing and if conditional branch in the preprocessor Evaluates condition, and if it is TRUE, preprocessing resolves to the token string true_case. Otherwise, processing resolves to no tokens.
| Parameters | |
|---|---|
| condition | - The boolean condition to evaluate. Must evaluate to 0 (FALSE) or 1 (TRUE) in the preprocessor |
| true_case | - The token string to evaluate to in the TRUE case |
#define NOT(x)
#include <include/Cnx/mpl/PPBool.h>
Macro for performing logical not (e.g. !) in the preprocessor Evaluates x, and if it is TRUE, preprocessing resolves to FALSE Otherwise, processing resolves to TRUE
| Parameters | |
|---|---|
| x | - The boolean to evaluate. Must evaluate to 0 (FALSE) or 1 (TRUE) in the preprocessor |
#define OR(x,
y)
#include <include/Cnx/mpl/PPBool.h>
Macro for performing logical or (e.g. ||) in the preprocessor Evaluates x and y, and if either are TRUE, preprocessing resolves to TRUE. Otherwise, preprocessing resolves to FALSE
| Parameters | |
|---|---|
| x | - The first boolean to evalulate. Must evaluate to 0 (FALSE) or 1 (TRUE) in the preprocessor |
| y | - The second boolean to evalulate. Must evaluate to 0 (FALSE) or 1 (TRUE) in the preprocessor |
#define AND(x,
y)
#include <include/Cnx/mpl/PPBool.h>
Macro for performing logical and (e.g. &&) in the preprocessor Evaluates x and y, and if both are TRUE, preprocessing resolves to TRUE. Otherwise, preprocessing resolves to FALSE
| Parameters | |
|---|---|
| x | - The first boolean to evalulate. Must evaluate to 0 (FALSE) or 1 (TRUE) in the preprocessor |
| y | - The second boolean to evalulate. Must evaluate to 0 (FALSE) or 1 (TRUE) in the preprocessor |