我认为这是不可能的,但我还是要问。
给定如下的 x-macro:
#define X_TABLE(_)\
_(1, a, "hi")\
_(2, b, "hello")\
_(3, c, "sup")
// ...
#define X(_1, _2, _3) SomeFunc(_1, _2, _3);
X_TABLE(X)
#undef X
上述内容将生成:
SomeFunc(1, a, "hi");
SomeFunc(2, b, "hello");
SomeFunc(3, c, "sup");
X_TABLE
有没有办法在的评估中跳过某些行X
,使得SomeFunc
不会为该行生成?
也许,生成类似这样的内容:
SomeFunc(1, a, "hi");
SomeFunc(3, c, "sup");