우선 순위 큐를 정렬하는 데 필요한 매개 변수를 인식하는 데 많은 문제가 있습니다. 내 사용자 정의 클래스에서 연산자보다 작게 오버로드되었지만 사용하지 않는 것 같습니다. 여기에 관련 코드입니다 :STL 우선 순위 대기열 사용자 지정 클래스
Node.h
class Node
{
public:
Node(...);
~Node();
bool operator<(Node &aNode);
...
}
Node.cpp
#include "Node.h"
bool Node::operator<(Node &aNode)
{
return (this->getTotalCost() < aNode.getTotalCost());
}
getTotalCost은() int로
MAIN.CPP
priority_queue<Node*, vector<Node*>,less<vector<Node*>::value_type> > nodesToCheck;
반환 무엇 내가 누락 및/또는 잘못하고 있습니까?
당신은 차이의 AI에 있어야합니다 클래스 :) http://stackoverflow.com/questions/1517854/priorityqueue-comparison-for-pointers – Polaris878
좋은 탐정 기술;) – bmalicoat