【发布时间】:2021-07-18 07:17:21
【问题描述】:
#include <iostream>
void f(auto x)
{
std::cout << x;
}
int main()
{
f(std::hex); // okay
f(std::endl); // error
// candidate template ignored:
// couldn't infer template argument 'x:auto'
}
为什么不能将std::endl 作为函数参数传递?
【问题讨论】:
标签: c++ overloading iostream template-argument-deduction