【发布时间】:2012-01-21 20:45:50
【问题描述】:
我有一个 std::list 图形边缘,我想根据它们的目标出度和入度对边缘进行排序。但是在我的比较函数中,我得到了无效运算符
bool compareEdges(const Edge *e1,const Edge *e2){
if(e1->destination->outdegree < e2->destination->outdegree){
return true;
}
else if(e1->destination->outdegree > e2->destination->outdegree){
return false;
}
else if(e1->destination->indegree > e2->destination->indegree){
return false;
}
return true;
}
这是对排序函数的调用。
currentNode->edgeList.sort(compareEdges);
请帮助我消除此异常。
谢谢
【问题讨论】:
-
(currentNode->edgeList).sort(compareEdges);有帮助吗? -
outdegree和indegree的类型有哪些? -
outdegree的类型是什么?? -
你能发布outdegree的数据类型吗?或者甚至更好的 Edge 数据结构?
-
什么是出度,什么是入度?你真的得到一个异常或只是一个编译器错误。请发布您得到的确切错误。
标签: c++ list exception sorting stl