我有以下代码使用模板和数组维度作为模板非类型参数
template<int n> double f(double c[n]);
...
double c[5];
f<5>(c); // compiles
f(c); // does not compile
Run Code Online (Sandbox Code Playgroud)
编译器是否应该能够在没有显式模板参数的情况下实例化第二个f?我正在使用g ++ 4.1
Geo*_*che 30
它在使用引用时有效:
template<size_t n> double f(double (&c)[n]);
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
9487 次 |
| 最近记录: |