How to make a variadic macro for std::cout?
问题 How would I make a macro that took a variable amount of arguments, and prints its out using std::cout? Sorry if this is a noob question, couldn't find anything that clarified variadic macros after searching around for the answer. Conceptual Example: #include <iostream> #define LOG(...) std::cout << ... << ... << std::endl int main() { LOG("example","output","filler","text"); return 0; } would output: exampleoutputfillertext 回答1: You do not need preprocessor macros to do this. You can write it