Getting pointer to template function
How can I get a pointer to an instantiated template function?
As a trivial example, say I have
Here's something that does not work: apply(square<double>, 3). On encountering this, the compiler complains: error: no matches converting function `square' to type `double (*)(double)'.
As a trivial example, say I have
template<typename T>
T square(const T& t) {
return t * t;
}andvoid apply(double (*f)(double), double x) {
return f(x);
}How can I get a pointer to an instance of square<double> so that I can pass it to apply?Here's something that does not work: apply(square<double>, 3). On encountering this, the compiler complains: error: no matches converting function `square' to type `double (*)(double)'.
