I want to programmatically retrieve the name of a C++ class instance at runtime. I'm aware that C++ doesn't support reflection yet, but is there any alternative solution out there? For instance given the following example:
class Foo {
Foo() {
auo name = reflect::getInstance().name();
std:;cout << name << std::endl;
}
};
void main() {
Foo my_obj;
}
The output should return "my_obj". I'm looking for any utility library that I could use to implement this basic reflection function.
I'm particularly wondering if libclang can be used to extract such information - if so, any hint for how to build the reflect function to do this.
Aucun commentaire:
Enregistrer un commentaire