I am working on an A* pathfinding algorithm, but am having trouble with an error I receive when i insert a struct called node into a set. The error reads: \"Error 1 erro
You need to create operator<
or specialize std::less
for your struct. Another solution could be to use std::array
:
struct node : std::array<5,int> {
int &f() { return data()[0]; }
int &g() { return data()[1]; }
int &h() { return data()[2]; }
int &x() { return data()[3]; }
int &y() { return data()[4]; }
};
and you will inherit operator<
from it. Another benefit - you can access underlying data as array, which would simplify serializing etc.