
21 Feb
2012
21 Feb
'12
12:32 p.m.
Hi, I am coding a simple serialization/factory lib and want to use class hash code based on std::string representing class name as a factory identifier. My question is: how portable / reliable is hash value produced by std::string hash_value() overload? Will it be the same across platforms? Across boost versions? Or maybe actual algorithm is dictated by standard? Or should I just go with explicit algo like crc32? btw. I was just very hardly bitten by the fact that hash_value() for const char* != hash_value() for std::string, (it is just being treated as regular pointer). In other words hash_value("Class") != hash_value(std::string("Class")) which gave me few more gray hair. Is that desirable? Cheers, Szymon Gatner