I'm trying to use a functor with definable state as the hasher for an unordered_set, the problem i'm faced with is I doesn't know how to initialize the functor passed as the template parameter. It would be something like this.
class A{
private:
class Hasher{
private:
int a;
public:
Hasher(int val=3):a(val){};
size_t operator()(const string & s) const{
return s[0]*a;
}
};
unordered_set<string,Hasher??> us;
int hasher_val;
public:
A(int h_val):hasher_val(h_val){};
}
The problem is, how can I define "a" for a value different to 3?