jeudi 17 mars 2016

How to use unordered_set with compare function?

I wrote my own compare function for the third template parameter of std::unorderd_set. My function is

static bool HasSamePosition(const Node& a, const Node& b);

in the class Node. Now I'm trying to use this function in my unordered set,

std::unordered_set<Node, std::hash<Node>, bool(*)(const Node& a, const Node& b)> closedlist(&Node::HasSamePosition);

but it doesn't work. The error ist, that no instance of the constructor is matching the argumentlist. What am I missing?

Aucun commentaire:

Enregistrer un commentaire