/*
- * Copyright 2013 Facebook, Inc.
+ * Copyright 2014 Facebook, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
#include <string>
#include <boost/type_traits.hpp>
-#ifdef __GNUC__
-# include <ext/hash_set>
-# include <ext/hash_map>
+#ifdef _GLIBCXX_SYMVER
+#include <ext/hash_set>
+#include <ext/hash_map>
#endif
+#include <unordered_set>
+#include <unordered_map>
+
#include "folly/Conv.h"
#include "folly/FBString.h"
#include "folly/FBVector.h"
+#include "folly/Portability.h"
#include "folly/Range.h"
#include "folly/ScopeGuard.h"
} // namespace folly
-// Hash functions for string and fbstring usable with e.g. hash_map
-#ifdef __GNUC__
-namespace __gnu_cxx {
+// Hash functions to make std::string usable with e.g. hash_map
+//
+// Handle interaction with different C++ standard libraries, which
+// expect these types to be in different namespaces.
+namespace std {
template <class C>
-struct hash<folly::basic_fbstring<C> > : private hash<const C*> {
- size_t operator()(const folly::basic_fbstring<C> & s) const {
+struct hash<std::basic_string<C> > : private hash<const C*> {
+ size_t operator()(const std::basic_string<C> & s) const {
return hash<const C*>::operator()(s.c_str());
}
};
+}
+
+#if defined(_GLIBCXX_SYMVER) && !defined(__BIONIC__)
+namespace __gnu_cxx {
+
template <class C>
struct hash<std::basic_string<C> > : private hash<const C*> {
size_t operator()(const std::basic_string<C> & s) const {
}
};
-} // namespace __gnu_cxx
+}
#endif
// Hook into boost's type traits