I’m probably being a complete idiot, but I’ve just seen this C++ syntax and I can’t for the life of me work out what it’s doing:
(*x)(&a, b, c);
A quick answer would be greatly appreciated.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Well there can be many more possibilities: it all depends on the type of all entities:
x,a,b,c. In C++, you can overload even comma operator.But I will only focus on
x, and see how things turn out to be. The actual answer, however, will be too long if all combinations are taken into account.Here
xcould one of these:And then you’re invoking it passing three arguments to it.
Here are few examples, assuming all other entities (
a,bc) asint:An assumption
Function pointer
Function object
Iterator
As @David said in comment that:
which is true, but I believe this possibility is partially covered by iterator, or at least the iterator example gave you enough hint to figure it out yourself. 🙂
Hope that helps.