我有如下代码:
unordered_set<AttrValue> output;
...
auto requiredType = variables.at(arg.value);
auto end = remove_if(output.begin(), output.end(),
[&](AttrValue x) {
return !matchingOutputType(requiredType, ast->getNodeType(ast->getNodeKeyAttribute(x)));
}); // queryevaluator_getcandidatelist.cpp(179)
output.erase(end);
错误在代码的第 4 行。所以我认为是因为remove_if
。但是怎么了?输出未定义常量?
Error 90 error C3892: '_Next' : you cannot assign to a variable that is const c:\program files (x86)\microsoft visual studio 10.0\vc\include\algorithm 1840
Error 109 error C3892: '_Next' : you cannot assign to a variable that is const c:\program files (x86)\microsoft visual studio 10.0\vc\include\algorithm 1840
输出窗口:
3>c:\program files (x86)\microsoft visual studio 10.0\vc\include\algorithm(1840): error C3892: '_Next' : you cannot assign to a variable that is const
3> c:\program files (x86)\microsoft visual studio 10.0\vc\include\algorithm(1853) : see reference to function template instantiation '_FwdIt std::_Remove_if<std::_List_unchecked_const_iterator<_Mylist>,_Pr>(_FwdIt,_FwdIt,_Pr)' being compiled
3> with
3> [
3> _FwdIt=std::_List_unchecked_const_iterator<std::_List_val<int,std::allocator<AttrValue>>>,
3> _Mylist=std::_List_val<int,std::allocator<AttrValue>>,
3> _Pr=`anonymous-namespace'::<lambda4>
3> ]
3> h:\dropbox\sch\cs3202\code\source\query\query evaluator\queryevaluator_getcandidatelist.cpp(179) : see reference to function template instantiation '_FwdIt std::remove_if<std::_List_const_iterator<_Mylist>,`anonymous-namespace'::<lambda4>>(_FwdIt,_FwdIt,_Pr)' being compiled
3> with
3> [
3> _FwdIt=std::_List_const_iterator<std::_List_val<int,std::allocator<AttrValue>>>,
3> _Mylist=std::_List_val<int,std::allocator<AttrValue>>,
3> _Pr=`anonymous-namespace'::<lambda4>
3> ]