Questions tagged «unqualified-name»

2
为什么此模板功能无法正常运行?
我在阅读有关模板函数的信息,并对这个问题感到困惑: #include <iostream> void f(int) { std::cout << "f(int)\n"; } template<typename T> void g(T val) { std::cout << typeid(val).name() << " "; f(val); } void f(double) { std::cout << "f(double)\n"; } template void g<double>(double); int main() { f(1.0); // f(double) f(1); // f(int) g(1.0); // d f(int), this is surprising …
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.