Expand to N successive invocations of MACRO.
Declared in <bsls_macrorepeat.h>
#define BSLS_MACROREPEAT(N, MACRO)
Expand to N invocations of MACRO(x), where x in each invocation is the next number in the sequence from 1 to N. If N is 0, then the expansion is empty. For example BSLS_MACROREPEAT(3, XYZ) expands to XYZ(1) XYZ(2) XYZ(3). The behavior is undefined unless N is a decimal integer (or is a macro that expands to a decimal integer) in the range 0 to 20. Note that MACRO is typically a macro with one argument, but may also be a function or functor.
| Name | Description |
|---|---|
| N | number of repetitions in the range 0 to 20 |
| MACRO | one-argument macro, function, or functor to invoke |