I have two templated function signatures. Here T can be either int or double.
template <typename T>
Box<T> f2p(Box<T> const& box, Point<T> const& pt, Orientation o)
{
...
}
template <typename T>
Box<T> p2f(Box<T> const& box, Point<T> const& pt, Orientation o)
{
...
}
Now depending upon direction, I want to call either f2p or p2f. I want to create a function pointer that points to either f2p or p2f. How do I create a function pointer to a templated function? I want to achieve the following effect:
typename <template T>
Box<T> do_transformation(Box<T> const& box, ..., int dir = 0)
{
function pointer p = dir ? pointer to f2p : pointer to p2f
return p<T>(box);
}
I try something like this but I get compile errors:
Box<T> (*p)(Box<T>, Point<T>, Orientation) = dir ? fc2p<T> : p2fc<T>