I would like to do the following:
template<typename Func>
class FunctionWrapper
{
public:
typedef decltype(Func()) ReturnType;
typedef ... ArgsType;
FunctionWrapper(Func func)
{
func_ = func;
}
ReturnType operator() (ArgsType args)
{
return func_(args);
}
private:
Func func_;
};
The problem is I don't know how to deduce the ArgsType from Func type. I'd like to make it work when the function returns/accepts nothing as well.
The usecase would then be:
FunctionWrapper<myFunction> wrapper;
auto result = wrapper(1, 2, 3);
Aucun commentaire:
Enregistrer un commentaire