samedi 28 mars 2015

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

Aucun commentaire:

Enregistrer un commentaire