I have an Agent's class and there I have some unordered_map variables
unordered_map<Node, Node> came_from; // <Parent, Child>
unordered_map<Node, unsigned int> g_score;
unordered_map<Node, unsigned int> f_score;
unordered_map<Node, unsigned int> closed_set;
The Node it's just a simple structure and it looks something like that
typedef struct Node {
uint x, y, f_score, g_score;
bool operator==(const Node &n) const { return (x == n.x && y == n.y); }
bool operator!=(const Node &n) const { return (x != n.x || y != n.y); }
friend ostream &operator<<(ostream &out, const Node &n) {
out << '[' << n.x << ", " << n.y << ']';
return (out);
}
} Node;
And when I starting the build, I have such error
Error C2280 "std::hash<_Kty>::hash(void)": attempting to reference a deleted function
with
[
_Kty=Node
] Coopirative_Pathfinding C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\MSVC\14.23.28019\include\unordered_map(117,1)
When I'am pass the pointer to the Node its working
unordered_map<Node*, Node> came_from; // <Parent, Child>
unordered_map<Node*, unsigned int> g_score;
unordered_map<Node*, unsigned int> f_score;
unordered_map<Node*, unsigned int> closed_set;
What am I doing wrong?