我收到如下错误:
Error 24 error C2440: 'initializing' : cannot convert from 'std::_List_const_iterator<_Mylist>' to 'AttrValue' c:\program files (x86)\microsoft visual studio 10.0\vc\include\xmemory 208
Error 25 error C2100: illegal indirection c:\program files (x86)\microsoft visual studio 10.0\vc\include\xrefwrap 49
Error 26 error C2296: '.*' : illegal, left operand has type 'AttrValue' c:\program files (x86)\microsoft visual studio 10.0\vc\include\xrefwrap 49
Error 37 error C2440: 'initializing' : cannot convert from 'std::_List_const_iterator<_Mylist>' to 'AttrValue' c:\program files (x86)\microsoft visual studio 10.0\vc\include\xmemory 208
Error 38 error C2100: illegal indirection c:\program files (x86)\microsoft visual studio 10.0\vc\include\xrefwrap 49
Error 39 error C2296: '.*' : illegal, left operand has type 'AttrValue' c:\program files (x86)\microsoft visual studio 10.0\vc\include\xrefwrap 49
它没有指向我的代码,所以我不知道出了什么问题。但是查看 MSDN 文档,我认为问题可能是由以下原因引起的:
function<bool(AttrValue)> QueryEvaluatorPrivate::getClausePredicate(Relation clauseType, int preferedIndex) {
switch (clauseType) {
case UsesRelation:
if (preferedIndex == 0)
return &QueryEvaluatorPrivate::hasVarsUsed;
return &QueryEvaluatorPrivate::hasStmtsUsing;
case UsesPRelation:
if (preferedIndex == 0)
return &QueryEvaluatorPrivate::hasVarsUsedInProc;
return &QueryEvaluatorPrivate::hasProcsUsing;
}
}
hasVarsUsed
和其他has*
函数只是返回 a 的函数bool
。这有什么问题吗?
更新
在@Cameron 的评论之后,在输出窗口中是output。我认为违规行是output.insert(x)
(最后一行):
...
function<bool(AttrValue)> clausePredicate = getClausePredicate(cl.type, prefered);
unordered_set<AttrValue> output;
if (prefered == pos) {
for (auto x = input.begin(); x != input.end(); ++x)
if (clausePredicate(*x))
output.insert(x);
...
但那有什么问题呢?也许我看错地方了?
更新 2
修复了第一个问题output.insert(x)
应该是output.insert(*x)
......但我有
Error 6 error C2100: illegal indirection c:\program files (x86)\microsoft visual studio 10.0\vc\include\xrefwrap 49
我认为违规行是:
return &QueryEvaluatorPrivate::hasVarsUsed;
我可能错误地返回函数?
// function declaration
bool QueryEvaluatorPrivate::hasVarsUsed(StmtNum s)