2017-04-18 32 views
0
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>   ] 

回答

6

你提升一個警告(」裝飾名稱長度超出「)到錯誤。 換句話說,您定義的複雜類型的內部名稱已超過4096個字符。 對應的MS documentation for the warning message更詳細地解釋了這個問題並提出了工作答案。

+0

哇,大量模板化標準庫的不幸後果 – vu1p3n0x

+0

@ vu1p3n0x不,這是使用Microsoft產品的不幸後果。有更好的產品來編寫C++。鐺編譯器遠遠優於微軟的努力。 CLion IDE非常出色。 –