I have the following code snippet:
template <class T>
int foo(T (*f)()) {
typedef T (*func)();
typedef functor<T, func> F; //this line
// ...
}
As you can see, I use typedef
for a function pointer (func
), but I want to remove it to simplify my code. I tried this:
template <class T>
int foo(T (*f)()) {
typedef functor<T, typename f> F;
// ...
}
But that doesn't compile. What is the right way to to spell that full typedef
for F
in a single line?