P99

◆ P99_SEP

#define P99_SEP (   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 semicolon.

Suppose you want to create a struct that has several fields of similar name and type.

#define FIELD_DECL(X) P99_PASTE2(type_, X) P99_PASTE2(X, _flag)
struct bits {
P99_SEP(FIELD_DECL, chaos, sat, grey);
};

This will result in the following expansion

struct bits {
type_chaos chaos_flag;
type_sat sat_flag;
type_grey grey_flag;
};
See also
P99_UNROLL for a similar macro that applies MACRO a fixed number of times
P99_SEQ 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 297 of file p99_for.h.

P99_SEP
#define P99_SEP(MACRO,...)
Apply the macro MACRO to the rest of the argument list.
Definition: p99_for.h:297