【发布时间】:2014-07-26 06:14:41
【问题描述】:
我们是两个学生,现在我们遇到了一个无法解决的大问题。我们向我们的老师寻求帮助,但他无法帮助我们,所以我们最后的机会就是这个论坛!
我们正在做一个项目:NPI 文件的命令解释器。
map<string,void(Interpreteur::*)()>::iterator trouve = interpreteur.myMap.find(saisie);
if(trouve == interpreteur.myMap.end())
cerr<<"command not found"<<endl;
else
(trouve->*second)();
我们必须使用名为“map”的对象,但我们无法获得第二个参数,名为..“Second”。为什么?代码块告诉我们错误在“else”中,这里是错误:
'second' 未在此范围内声明。
我们也试过了:
map<string,void(Interpreteur::*)()>::iterator trouve = interpreteur.myMap.find(saisie);
if(trouve == interpreteur.myMap.end())
cerr<<"command not found"<<endl;
else
(trouve.second)();
并且代码块得到了回答:
错误:'std::map, void (Interpreteur::*)()>::iterator' 没有名为 'second' 的成员
如果有人可以帮助我们,它将拯救我们的项目,我们必须在明天结束它。我们将非常感激。
非常感谢您的帮助,如果有问题我们可以回答:)
【问题讨论】: