This question already has an answer here:
- How can I add reflection to a C++ application? 30 answers
- Why does C++ not have reflection? 14 answers
I want to get the value of a member but the member name is stored as string. How can I get the member value ?
struct Person
{
string name = "MyName";
int age = 15;
}
int main()
{
struct Person p;
string s= "name";
cout<<p.s<<endl; //This will give error since s is not member of struct
}
Is there a way to get this done?
Aucun commentaire:
Enregistrer un commentaire