5 Mar
2013
5 Mar
'13
5:13 p.m.
Hi all, My parser is building string_t = flyweight<std::string> for identifiers, and it works very well. Now, I would like to make an unordered_map <string_t, foo_t>, but I have to define a hash function for string_t. I can do it but since the whole point of flyweight is to make unique instances, it would be a pity to hash the value. So I hash the address of the result of get(). Is this ok? So far everything is fine, but I might have missed something. In particular, I don't understand why their is no standard hash function defined for flyweights. Thanks in advance!