【发布时间】:2020-02-25 10:08:51
【问题描述】:
考虑以下函数模板:
template <typename T1, typename T2>
void foo(T1 a, T2 b){// Do something.}
现在假设我希望T1 为int,但T2 由编译器根据b 的类型推导出来。像foo<int,...>(1,b) 这样的东西。有可能吗?
谢谢!
【问题讨论】:
标签: c++ templates type-deduction function-templates