There are several template classes that work with function pointers taking one, two, etc. arguments.
template <typename A1, int(*func)(A1)>
class Something1
{
public:
static void f()
{
A1 a1;
// ...
int r = func(a1);
// ...
}
};
template <typename A1, typename A2, int(*func)(A1, A2)>
class Something2
{
public:
static void f()
{
A1 a1;
A2 a2;
// ...
int r = func(a1, a2);
// ...
}
};
How do I write one template class that can work with pointers to functions that take any number of arguments? Is it possible?
Aucun commentaire:
Enregistrer un commentaire