Remove disallowed &* of FwdIterator
[folly.git] / folly / String.h
index da93cd265d106a296e60a651aad59cd1cfb16bfd..90f9c7393857a13bc7dde1dea85f2eaa9ecf3f60 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * 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"
 
@@ -491,17 +495,24 @@ std::string join(const Delim& delimiter,
 
 } // 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 {
@@ -509,7 +520,7 @@ struct hash<std::basic_string<C> > : private hash<const C*> {
   }
 };
 
-} // namespace __gnu_cxx
+}
 #endif
 
 // Hook into boost's type traits