preprocessor¶
The contents of this module can be included with the header
hpx/modules/preprocessor.hpp
. These headers may be used by user-code but are not
guaranteed stable (neither header location nor contents). You are using these at
your own risk. If you wish to use non-public functionality from a module we
strongly suggest only including the module header hpx/modules/preprocessor.hpp
, not
the particular header in which the functionality you would like to use is
defined. See Public API for a list of names that are part of the public
HPX API.
Defines
-
HPX_PP_CAT
(A, B)¶ Concatenates the tokens
A
andB
into a single token. Evaluates toAB
- Parameters
A
: First tokenB
: Second token
Defines
-
HPX_PP_EXPAND
(X)¶ The HPX_PP_EXPAND macro performs a double macro-expansion on its argument.
This macro can be used to produce a delayed preprocessor expansion.
- Parameters
X
: Token to be expanded twice
Example:
#define MACRO(a, b, c) (a)(b)(c) #define ARGS() (1, 2, 3) HPX_PP_EXPAND(MACRO ARGS()) // expands to (1)(2)(3)
Defines
-
HPX_PP_IDENTITY
(...)¶
Defines
-
HPX_PP_NARGS
(...)¶ Expands to the number of arguments passed in
Example Usage:
HPX_PP_NARGS(hpx, pp, nargs) HPX_PP_NARGS(hpx, pp) HPX_PP_NARGS(hpx)
- Parameters
...
: The variadic number of arguments
Expands to:
3 2 1
Defines
-
HPX_PP_STRINGIZE
(X)¶ The HPX_PP_STRINGIZE macro stringizes its argument after it has been expanded.
The passed argument
X
will expand to"X"
. Note that the stringizing operator (#) prevents arguments from expanding. This macro circumvents this shortcoming.- Parameters
X
: The text to be converted to a string literal
Defines
-
HPX_PP_STRIP_PARENS
(X)¶ For any symbol
X
, this macro returns the same symbol from which potential outer parens have been removed. If no outer parens are found, this macros evaluates toX
itself without error.The original implementation of this macro is from Steven Watanbe as shown in http://boost.2283326.n4.nabble.com/preprocessor-removing-parentheses-td2591973.html#a2591976
HPX_PP_STRIP_PARENS(no_parens) HPX_PP_STRIP_PARENS((with_parens))
- Example Usage:
- Parameters
X
: Symbol to strip parens from
This produces the following output
no_parens with_parens