__VA_ARGS__传递类型然后键入

时间:2016-06-03 22:20:47

标签: c++ c++11 arguments visual-studio-macros

我有一个看起来如下的宏

org.apache.kafka.common.TopicPartition

但现在你可以看到我想在???的位置解析va args的类型。 例如,我可以这样做:

#define dofirst(...) setoptfirst(???); executefirstopt(__VA_ARGS__)

或:

dofirst(int,5);

所以最后宏应该像那样运行:

dofirst((int)5); (i would prefer the first but this is also okay)

0 个答案:

没有答案