c++ - map 中的 vector

标签 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_VarList (list) 的键是否存在时:

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>          ]

最佳答案

您将警告(“超出装饰名称长度”)升级为错误。 换句话说,您定义的复杂类型的内部名称已超过 4096 个字符。 对应的MS documentation for the warning message更详细地解释问题并提出解决方法。

关于c++ - map 中的 vector ,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43464728/

相关文章:

r - 我如何找到连续的值

c++ - WSL Ubuntu 20.04.3 错误 : XDG_RUNTIME_DIR not set in the environment

c++ - 如何获取keyPoint ID

java - 当这些是对象时,如何根据映射的值而不是键对映射进行排序?

C++:从另一个 vector 指向对象的指针 vector

c++ - 使用迭代器构造 std::vector 时不需要保留吗?

c++ - fatal error RC1015

c++ - C++ 中的 const 指针与 const 引用

python - 具有公共(public)子键的新字典

javascript - 访问键值