File macro_for_each.hxx

Defines

_me_1(_call, x)

_me_x set of macros expand a number of arguments without ‘;’ between them

_me_2(_call, x, ...)
_me_3(_call, x, ...)
_me_4(_call, x, ...)
_me_5(_call, x, ...)
_me_6(_call, x, ...)
_me_7(_call, x, ...)
_me_8(_call, x, ...)
_me_9(_call, x, ...)
_me_10(_call, x, ...)
_fe_1(_call, x)

_fe_x set of macros expand a number of arguments with ‘;’ between them

_fe_2(_call, x, ...)
_fe_3(_call, x, ...)
_fe_4(_call, x, ...)
_fe_5(_call, x, ...)
_fe_6(_call, x, ...)
_fe_7(_call, x, ...)
_fe_8(_call, x, ...)
_fe_9(_call, x, ...)
_fe_10(_call, x, ...)
_GET_FOR_EACH_EXPANSION(_1, _2, _3, _4, _5, _6, _7, _8, _9, _10, NAME, ...)

When called with VA_ARGS first, this evaluates to an argument which depends on the length of VA_ARGS. This is used to find the appropriate macro to begin the expansion.

MACRO_FOR_EACH(mac, ...)

Apply a macro (first argument) to each of the following arguments. Currently supports up to 10 arguments.

Example:

MACRO_FOR_EACH(test, a, b, c)

expands to

test(a) test(b) test(c)

Notes:

  • No semicolon is inserted after each expansion
  • No braces are put around the expansion. These should usually be added in the top-level macro to avoid surprising results.

MACRO_FOR_EACH_FN(fn, ...)

Apply a function (first argument) to each of the following arguments. Currently supports up to 10 arguments.

Example:

MACRO_FOR_EACH_FN(test, a, b, c)

expands to

test(a); test(b); test(c);

Notes:

  • A ; is inserted after each expansion
  • No braces are put around the expansion. These should usually be added in the top-level macro to avoid surprising results.