与xtree文件相关的问题

莫名其妙的错误,定位到了xtree文件

Posted by 雯饰太一 on May 28, 2023

与xtree文件相关的问题

1
2
1>C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\include\xtree(1187): error : no operator "++" matches these operands
1>..\..\src\easyapi\general\egis_sail_impl.cpp(445): error : no suitable user-defined conversion from "std::_Tree_const_iterator<std::_Tree_val<std::_Tmap_traits<std::string, std::string, std::less<std::string>, std::allocator<std::pair<const std::string, std::string>>, 0>>>" to "std::_Tree_iterator<std::_Tree_val<std::_Tmap_traits<std::string, std::string, std::less<std::string>, std::allocator<std::pair<const std::string, std::string>>, 0>>>" exists

原因:可能是map的使用方法出现了错误

错误使用: o_outMap.*insert*(pName,pValue);

正确使用: o_outMap.*insert*(std::*pair*<std::*string*,std::*string*>(pName,pValue)); 关于map的迭代器,使用时需要注意pair是一个二元的结构体,直接取第几个元素即可 std::*string*& o_str; AttrMap::*iterator* iter; o_str=iter->second;

备注:不同的编译器对于错误的提示位置是不一样的 V100提示的时候会直接提示insert函数出现了错误,但是intel 16.0提示的时候在xtree位置