“之前:”之前的位置在哪里?

时间:2019-06-17 16:46:27

标签: c++-cli clr

尝试编译此代码

std::map<int, struct critere_struct> Criteres ;
typedef std::map<int, critere_struct>::value_type crit_elem ;
for (crit_elem critere : Criteres)
   ....

给我一​​个error C2143: syntax error : missing ',' before ':'for行上。没有迹象表明在编辑器中会出现此错误。我也不能使用std::for_each构造,并且在线示例与我的代码足够相似,因此看起来很正确。我也尝试过autostd::pair<int, critere_struct>;编辑器中未显示任何错误,但我遇到了相同的编译错误。 critere_struct类型只是CString的三个。这在VS2012中的VS2010项目中,位于c ++ / cli中。我不知道逗号在哪里。

我不能使用最新的编译器,这是我无法控制的更大解决方案的一部分。

请注意

typedef std::map<int, critere_struct>::iterator crit_it ;
for (crit_it critere = Criteres.begin ();
  critere != Criteres.end ();
  critere++)
  ....

构造有效,我只是不喜欢它。如果您认为此问题来自编译器版本,请在回答中说明。

0 个答案:

没有答案
相关问题