preprocessor

#include <hpx/preprocessor/stringize.hpp>

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

#include <hpx/preprocessor/strip_parens.hpp>

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 to X 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

#include <hpx/preprocessor/expand.hpp>

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)

#include <hpx/preprocessor/cat.hpp>

Defines

HPX_PP_CAT(A, B)

Concatenates the tokens A and B into a single token. Evaluates to AB

Parameters
  • A: First token

  • B: Second token

#include <hpx/preprocessor/nargs.hpp>

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