Is it possible to pass to a debug streaming operator a list of heterogeneous types that are streamable?
string str("blabla");
std::cout << {"A", 3, str} << std::endl;
I guess it could be possible with something like a variadic template? I want the operator << to call each of the elements in the list and append a comma.
You can't use initializer list for heterogeneous types, but
std::tuple
is ok.Make sure there is no unnecessary copy made. Here is a solution using C++17.