Prev: Type traits and accessibility
Next: template<unsigned char local_size, typename wide_type> struct fast_string{...};
From: ivan huang on 13 Apr 2010 01:41 code: template <typename T> void f(T&) { cout << "void f(T&)" << endl; } template <typename T> void f(const T&) { cout << "void f(const T&)" << endl; } template <typename T> void g(T& t) { f(t); f<const T>(t); // My problem is *here* } My target is to call f(const T&) explicitly. The code above is OK, but when I change f<const T>(t) to f<const T&>(t), the g++ compliler said "no matching function for call to `f(int&)'" ? Thanks! -- [ See http://www.gotw.ca/resources/clcm.htm for info about ] [ comp.lang.c++.moderated. First time posters: Do this! ] |