Say I have the following class: (possibly meta-generated)
class MyClass
{
public:
myMethod();
...
}
Assuming a few things here:
1.) I have the class name from somewhere (let's pretend)
2.) I have the names of the class methods somewhere ( std::map< std::string, std::function> ... perhaps? )
So...since I may not know the name of myMethod() until runtime, is there a way to call it using a std::string ? This is assuming that I have the names of a class functions stored somewhere.
MyClass example;
std::string funcName{ findMyMethod() };//get std::string name of myMethod
example.someHowRunMyMethodUsing_funcName_();
I know C++ is generally not suited for introspection-like situations, but I'd like to figure this out.
Thanks!