问题
My problem is that I would like to use the function launched by the keyword received in carac from a text file, and use the string right after carac in this function that is in an other file included but I have no idea how to do it.
for(std::string carac; fichier>>carac;)
{
auto found = _map.find(carac);
if(found != _map.end()
{
found->second();
pile_double.afficher(); // Pile is the french word for a LIFO Queue, afficher is the one for display
}
}
回答1:
If I'm understanding correctly all you need to do is extract again:
if (found != _map.end())
{
std::string name;
fichier >> name; // this is the second word
found->second();
pile_double.afficher();
}
来源:https://stackoverflow.com/questions/24071793/using-a-var-from-a-text-file