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
As you may know if you've familiarized yourself with the documentation of std::set, it is an ordered container. Therefore there must be a way to compare the elements of the set so that they can be ordered. From the documentation, we know that the default comparison functor of std::set is std::less.
Further, as you may know, std::less does:
Unless specialized, invokes operator< on type T.
Since std::less isn't specialized for node, it uses operator<.
The error message tells you that an overload for operator< does not exist that would have const node (or anything that a node could be converted to) as the left operand.
The solution is to define such overload.