Well, there can be many possibilities: it all depends on the type of all objects: x , a , b , c . In C ++, you can even overload the comma operator.
But I will focus only on x and see how everything turns out. However, the actual answer will be too long if all combinations are taken into account.
(*x)(&a, b, c);
Here x can be one of the following:
- Function pointer
- Pointer to a function object.
- An iterator that, when dereferenced, returns a pointer function or function object.
- (one more from below, partially covered by the previous one!)
And then you call it, passing it three arguments.
Here are a few examples, counting all the other objects ( a , b c ) as int :
Assumption
int a,b,c;
Function Index
void f(int *,int, int); auto *x = f; (*x)(&a,b,c);
Function object
struct X { void operator()(int*,int,int); }; X y, *x = &y; (*x)(&a,b,c);
Iterator
std::list<std::function<void(int*,int,int)> l {X(), f}; auto x = l.begin();
As @David said in a comment that:
However, there is a fourth possibility: x may be an instance of some class that overloads the * operator to return a pointer to a function or function object.
which is true, but I believe that this possibility is partially covered by the iterator, or at least the example of the iterator gave you enough hint to figure it out yourself. :-)
Hope this helps.
Nawaz source share