Specialize hash<basic_fbstring> in correct namespaces
authorPeter Griess <pgriess@fb.com>
Fri, 31 Jan 2014 20:21:15 +0000 (12:21 -0800)
committerSara Golemon <sgolemon@fb.com>
Thu, 6 Feb 2014 19:50:14 +0000 (11:50 -0800)
Summary:
- Use the BOOST_STD_EXTENSION_NAMESPACE macro to pick the namespace to
use for hash specializations

Test Plan:
- fbconfig -r unicorn/utils/ && fbmake opt
- fbconfig -r folly && fbmake runtests
- Build in fbobjc with libc++
@override-unit-failures

Reviewed By: rajatr@fb.com

FB internal diff: D1153422

Blame Revision: D1152140

folly/String.h

index b7a05f1c734407c06cc051f19595507fa59c9743..bea17b7261953ba91a15648ba4ba183273281a5b 100644 (file)
 #include <string>
 #include <boost/type_traits.hpp>
 
+#ifdef _GLIBCXX_SYMVER
+#include <ext/hash_set>
+#include <ext/hash_map>
+#endif
+
 #include <unordered_set>
 #include <unordered_map>
 
@@ -491,7 +496,10 @@ std::string join(const Delim& delimiter,
 } // namespace folly
 
 // Hash functions for string and fbstring usable with e.g. hash_map
-FOLLY_NAMESPACE_STD_BEGIN
+//
+// We let Boost pick the namespace here for us, since it has logic to do the
+// right thing based on the C++ standard library implementation being used.
+namespace BOOST_STD_EXTENSION_NAMESPACE {
 
 template <class C>
 struct hash<folly::basic_fbstring<C> > : private hash<const C*> {
@@ -507,7 +515,7 @@ struct hash<std::basic_string<C> > : private hash<const C*> {
   }
 };
 
-FOLLY_NAMESPACE_STD_END
+}
 
 // Hook into boost's type traits
 namespace boost {