Код: Выделить всё
typedef struct WWCryptoAuthorizationHeader
{
int age;
const char *name;
const char *address;
} StudentInfo;
Я пробую это..
Код: Выделить всё
void foo(StudentInfo *studentInfo, const char* key)
{
std::map studentInfoMap;
studentInfoMap.insert(std::make_pair("name", studentInfo->name));
studentInfoMap.insert(std::make_pair("address", studentInfo->address));
for(auto &item : studentInfoMap)
{
if (strcmp(key, item.first.c_str()) == 0)
{
item.second = "John";
}
}
}
Подробнее здесь: https://stackoverflow.com/questions/792 ... -stdmap-va
Мобильная версия