Skip to content

Can't pass std::endl as parameter #1

@theypsilon

Description

@theypsilon
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.

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions