I have a structure like this:
struct Person {
std::string name;
int age;
std::string title;
float income;
};
In the python side, I have a dict like this:
person = { 'name':'Alex',
'age':36,
'title':'programmer',
'income':13435.40
}
Now I want to convert the Python dict to the C++ program by using ctypes. There is a stupid way to do this task is that we can write 4 c-style functions to set these four elements independently. How can we do this task in a single function, which can solve different data type (string, int, float)?