My code looks like that:
class Node : public bitset<BITS_COUNT> {
public:
Node(string s) : bitset<BITS_COUNT>(s) {}
void setGroup(unordered_set<Node>* newSet) { currentGroup = newSet; }
unordered_set<Node>* getCurrentSet() { return currentGroup; }
private:
unordered_set<Node>* currentGroup = nullptr;
};
But complier doesn't allow me to do this, since there is no hash function defined for class Node. I'd like it to use hash function from base class, so I did this:
namespace std
{
template<>
struct hash<Node>
{
size_t operator()(const Node& k) const
{
return k.hash();
}
};
}
But it still doesn't work. If I put this before Node delcaration, k.hash() is undefined (and I can't forward declare Node: public bitset<> since it isn't possible). If I put this after class declaration I get error that there is no hash function for class Node.
How can I solve this problem?
Thanks Frank, your comment is actually a solution for me. If someone needs the code it looks like this: