From: ivan huang on
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! ]