concat
concat copied to clipboard
Can't pass std::endl as parameter
concat(1,2,3,std::endl); // error: requires 3 arguments, but 4 were provided
It looks like is not possible to infer between the char version of std::endl and wchar_t, and therefore it displays that weird error message. Because a parameter pack is used in order to allow variadic parameters with perfect forwarding, I see no way to help the compailer to infer the std::endl type in a arbitrary position of the parameter list.
std::ostream& (*s)(std::ostream&) = std::endl;
std::cout << concat(1,2,3, s);
works as expected, but doesn't feel right.