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 using 1
#define FALSE
Macro for logical false, used to clarify intent over using 0
#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 string true_case. Otherwise, processing resolves to the token string false_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 string true_case. Otherwise, processing resolves to no tokens.
#define NOT(x)
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
#define OR(x, y)
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
#define AND(x, y)
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

Define documentation

#define TRUE

Macro for logical true, used to clarify intent over using 1

#define FALSE

Macro for logical false, used to clarify intent over using 0

#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 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)

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)

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)

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)

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