I'm trying to implement my own key comparator for std::map as follows:
auto cost_compare = [](const OffsetCoords& left, const OffsetCoords& right) {
return (left == right); };
std::map<OffsetCoords, int, decltype(cost_compare)> cost_so_far(cost_compare);
where OffsetCoords
is struct, vector of x, y values with overloaded operator==
code builds fine, but when I call cost_so_far.count(some_offsetcoords_variable)
it throws exception 'Expression: invalid comparator'.
What's the proper way to do this?
Aucun commentaire:
Enregistrer un commentaire