How many people know that the comma operator is overloadable?
#include <iostream> | |
template<typename T> | |
std::ostream& operator,(std::ostream& s, const T& x) | |
{ | |
return s << ", " << x; | |
} | |
int main(int argc, char* argv[]) | |
{ | |
std::cout << "A", "bunch", "of", "comma-separated", "strings"; | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment