我如何创建一个带有可变数量参数的宏,并使用std :: cout打印出来?很抱歉,如果这是一个菜鸟问题,在搜索答案后找不到任何澄清可变参数的宏.
概念示例:
#include <iostream>
#define LOG(...) std::cout << ... << ... << std::endl
int main() {
LOG("example","output","filler","text");
return 0;
}
Run Code Online (Sandbox Code Playgroud)
输出:
exampleoutputfillertext
Run Code Online (Sandbox Code Playgroud)