And*_*zos 1 c++ c++11
为什么这个C++ 11程序不起作用:
template <typename T> void f(T t = 42) {} int main() { f(); }
为什么不能T从默认参数中推断出来42?
T
42
eca*_*mur 5
14.8.2.5 [temp.deduct.type]:
19 - 无法从函数默认参数的类型推导出模板类型参数.[...]
给出的示例与您的示例基本相同.
归档时间:
12 年,2 月 前
查看次数:
63 次
最近记录: