Goo*_*ies 1 c++ templates types casting
有没有办法从模板类中提取typedef?例如,这就是我想要做的:
template<typename T, typename... Args>
class Foo{
public:
   typedef T(*Functor)(Args...);
   Foo() = default;
};
template<typename T, typename... Args>
Foo<T, Args...> make_foo(T(*f)(Args...)){
    return Foo<T, Args...>;
}
int bar(int i){
    return i * 2;
}
using type = make_foo(bar)::Functor;
我不能做到这一点.但是,我可以这样做:
using type = Foo<int, int>::Functor;
这种打败了我的目的.有没有办法包装一个函数,以便我可以以类型形式提取它?
会decltype不够好?
using type = decltype(make_foo(bar))::Functor;