omi*_*ron 10 c++ stl c++11 visual-studio-2013
我正在尝试使用C++ 11初始化地图地图.我的编译器是VS 2013 Express.
unordered_map<EnumType, unordered_map<string, string>> substitutions = {
{
Record::BasementType,
{
{ "0", "" },
{ "1", "Slab or pier" },
{ "2", "Crawl" }
}
},
{
Record::BuildingStyle,
{
{ "0", "" },
{ "1", "Ranch" },
{ "2", "Raised ranch" }
}
},
// ... and so on
};
Run Code Online (Sandbox Code Playgroud)
它是编译但我在ntdll.dll中获得断点.但是这段代码的简化版本:
unordered_map<EnumType, unordered_map<string, string>> substitutions = {
{
Record::BasementType,
{
{ "0", "" },
{ "1", "Slab or pier" },
{ "2", "Crawl" }
}
},
// *nothing more*
};
Run Code Online (Sandbox Code Playgroud)
工作正常.
当我在地图中有多个对时,为什么这不起作用?怎么做得更好?
Ste*_*vej 19
这是一个已知的编译器错误,http://connect.microsoft.com/VisualStudio/feedback/details/800104/.编译器对初始化列表中的临时对象感到困惑,甚至可以反复破坏单个对象.因为这是沉默的坏代码,我已经要求编译器团队优先解决这个问题.
| 归档时间: |
|
| 查看次数: |
2458 次 |
| 最近记录: |