矢量在地图中的地图

时间:2017-04-18 06:04:37

标签: c++ dictionary vector

typedef vector<string>              tdv_Str;
typedef map<string, tdv_Str, CaseI> tdm_StrList; // var name, possible values
typedef map<short, tdm_StrList>     tdm_VarList; // type, var list

* CaseI是字符串映射排序,不区分大小写。

当我检查tdm_VarListlist)的密钥是否存在时:

if (list.count(key) == 0)
// ...

然后编译它,我得到以下错误:

1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xtree(1089): error C2220: warning treated as error - no 'object' file generated
1>          c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\map(81) : see reference to class template instantiation 'std::_Tree<_Traits>' being compiled
1>          with
1>          [
1>              _Traits=std::_Tmap_traits<short,tdm_StrList,std::less<short>,std::allocator<std::pair<const short,tdm_StrList>>,false>
1>          ]
1>          Src\APS.cpp(683) : see reference to class template instantiation 'std::map<_Kty,_Ty>' being compiled
1>          with
1>          [
1>              _Kty=short,
1>              _Ty=tdm_StrList
1>          ]
1>c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xtree(1089): warning C4503: 'std::_Tree<_Traits>::_Insert' : decorated name length exceeded, name was truncated
1>          with
1>          [
1>              _Traits=std::_Tmap_traits<short,tdm_StrList,std::less<short>,std::allocator<std::pair<const short,tdm_StrList>>,false>
1>          ]

1 个答案:

答案 0 :(得分:6)

您将警告(&#34;超出装饰名称长度&#34;)提升为错误。 换句话说,您定义的复杂类型的内部名称已超过4096个字符。 相应的MS documentation for the warning message更详细地解释了问题并提出了工作原因。