Remove unnecessary and broken hash specializations
authorTudor Bosman <tudorb@fb.com>
Wed, 9 Jul 2014 15:42:15 +0000 (08:42 -0700)
committerTudor Bosman <tudorb@fb.com>
Wed, 9 Jul 2014 20:52:25 +0000 (13:52 -0700)
commitdf377ed2a89f02d266468ef2a2d4ea109f741138
treebc1ba053443d2fc69331f2ffc3d5e73d34510cc3
parented684e7693cf2ca054f19d9c2ab02e4e0acdf2b9
Remove unnecessary and broken hash specializations

Summary:
No need to specialize std::hash for std::basic_string; the STL already does
this. Plus, the specializations were broken in multiple ways:

1. std::hash does not treat const char* specially, so it just hashes the
pointer value (contrasting the old __gnu_cxx::hash, which hashed a C-string)

2. Either way, using __gnu_cxx::hash<const char*> for std::string is broken,
as it won't hash anything past the first null byte.

Also, make sure fbstring gets the same (full) specializations as std::string
does in the standard.

Test Plan: fbconfig -r folly && fbmake runtests_opt, also tests in tupperware/agent which is still using __gnu_cxx::hash_map with string keys.

Reviewed By: pgriess@fb.com, andrei.alexandrescu@fb.com

Subscribers: njormrod, jhj, kma, lesha

FB internal diff: D1426479
folly/FBString.h
folly/String.h