Commit 07580800 authored by Peter Griess's avatar Peter Griess Committed by Sara Golemon

Specialize hash<basic_fbstring> in correct namespaces

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
parent a66c2259
...@@ -21,6 +21,11 @@ ...@@ -21,6 +21,11 @@
#include <string> #include <string>
#include <boost/type_traits.hpp> #include <boost/type_traits.hpp>
#ifdef _GLIBCXX_SYMVER
#include <ext/hash_set>
#include <ext/hash_map>
#endif
#include <unordered_set> #include <unordered_set>
#include <unordered_map> #include <unordered_map>
...@@ -491,7 +496,10 @@ std::string join(const Delim& delimiter, ...@@ -491,7 +496,10 @@ std::string join(const Delim& delimiter,
} // namespace folly } // namespace folly
// Hash functions for string and fbstring usable with e.g. hash_map // 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> template <class C>
struct hash<folly::basic_fbstring<C> > : private hash<const 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*> { ...@@ -507,7 +515,7 @@ struct hash<std::basic_string<C> > : private hash<const C*> {
} }
}; };
FOLLY_NAMESPACE_STD_END }
// Hook into boost's type traits // Hook into boost's type traits
namespace boost { namespace boost {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment