P99

◆ P99_SEQ

#define P99_SEQ (   MACRO,
  ... 
)    P00_MAP_(P99_NARG(__VA_ARGS__), MACRO, (,), __VA_ARGS__)

Apply the macro MACRO to the rest of the argument list.

The macro is called with each of the other arguments and the results are separated by commas.

Suppose you have an enumeration type with three values:

enum { one, two, three } ;
#define ENUM_INIT(X) [X] = P99_STRINGIFY(X)
char const* names[] = { P99_SEQ(ENUM_INIT, one, two, three) };

This will result in the following expansion

char const* names[] = { [one] = "one", [two] = "two", [three] = "three" };
See also
P99_REPEAT for a similar macro that applies MACRO a fixed number of times
P99_SEP for a similar macro that separates the different parts with a ;
P99_SER for a similar macro that separates the different parts with a space token
P99_FOR for a more Generic type expressions and Flexible array members utility
Remarks
argument 0 should correspond to a macro name

Definition at line 250 of file p99_for.h.