I am trying to delegate a method call using a nested std::invoke
. Sample code:
class Executor
{
public:
bool Execute(bool someFlag);
};
template <class TMemberFunction, class TInstance, typename TResponse>
class Invoker
{
public:
TResponse Invoke(TMemberFunction* function, TInstance* instance, bool someFlag) {
return std::invoke(function, instance, someFlag);
}
};
void Main()
{
// Create an executor
Executor executor;
bool someFlag = true;
// How can I pass the member function type here?
Invoker<???, Executor, bool> invoker;
// Invoke member method
bool response = invoker.Invoke(&Executor::Execute, &executor, someFlag);
}
What's the proper way to pass the member function's type to the Invoker
template?
Edit: sample code corrections.