lundi 28 septembre 2015

C++ std::function variable with varying arguments

In my callback system I want to store std::function (or something else) with varying arguments.

Example:

  1. I want to call void()
  2. I want to call void(int, int)

I want 1) and 2) to be stored in the same variable and choose what to call in actuall call

FunctionPointer f0;
FunctionPointer f2;

f0();
f2(4, 5);

Is it possible to do something like this? Or I have to create several "FuntionPointer" templates based on input arguments count.

Aucun commentaire:

Enregistrer un commentaire