Is it possible to invoke the function of a class based on the fact that it is the only public one ? What I mean:
Something like:
double res = MyClass().myFunction(n);
becomes
double res = MyClass()[0](n);
Ideally I would have liked to call the function using a string with its name:
double res = MyClass().reflection("myFunction")(n);
But it seems not possible without wasting at least twice the ink to write the function name (function pointer and corresponding string in a map).
Aucun commentaire:
Enregistrer un commentaire