Skip to content

Commit 2f5c7cf

Browse files
committed
fix hash function return value
1 parent dc57a11 commit 2f5c7cf

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

cpp/stlastar.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,7 @@ given where due.
3333

3434
// stl includes
3535
#include <algorithm>
36-
#include <set>
3736
#include <unordered_set>
38-
// #include <boost/functional/hash.hpp>
3937
#include <vector>
4038
#include <cfloat>
4139

@@ -777,7 +775,7 @@ template <class UserState> class AStarSearch
777775
// Heap (simple vector but used as a heap, cf. Steve Rabin's game gems article)
778776
vector< Node *> m_OpenList;
779777

780-
// Closed list is a set
778+
// Closed is an unordered_set
781779
struct NodeHash {
782780
size_t operator() (Node* const& n) const {
783781
return n->m_UserState.Hash();
@@ -833,7 +831,7 @@ template <class T> class AStarState
833831
virtual bool GetSuccessors( AStarSearch<T> *astarsearch, T *parent_node ) = 0; // Retrieves all successors to this node and adds them via astarsearch.addSuccessor()
834832
virtual float GetCost( T &successor ) = 0; // Computes the cost of travelling from this node to the successor node
835833
virtual bool IsSameState( T &rhs ) = 0; // Returns true if this node is the same as the rhs node
836-
virtual float Hash() = 0;
834+
virtual std::size_t Hash() = 0; // Returns a hash for the state
837835
};
838836

839837
#endif

0 commit comments

Comments
 (0)