In C++17, fold expression is available, so to print arguments, we could use
#define EOL '\n'
template<typename ...Args>
void output_argus(Args&&... args)
{
(cout << ... << args) << EOL;
}
int main()
{
output_argus(1, "test", 5.6f);
}
having the output
1test5.6
What if I would like using the fold expression appending an extra character '\n' to each element to get the following results?
1
test
5.6
Is that even possible? If yes, how?