Use C++11 unordered collections instead of libstdc++ extensions
authorPeter Griess <pgriess@fb.com>
Fri, 31 Jan 2014 00:15:48 +0000 (16:15 -0800)
committerSara Golemon <sgolemon@fb.com>
Thu, 6 Feb 2014 19:50:13 +0000 (11:50 -0800)
Summary:
- The fbobjc builds complain about use of deprecated <ext/hash_set> and
friends, and then fail because of -Werror. Just use the C++ standard
collections.

Test Plan:
- fbconfig -r folly && fbmake runtests
- Build for iOS and Android
@override-unit-failures

Reviewed By: andrei.alexandrescu@fb.com

FB internal diff: D1152140

folly/String.h

index 31b21b1e8ab837d5e9f6ce5e8506fc215212b539..b7a05f1c734407c06cc051f19595507fa59c9743 100644 (file)
 #include <string>
 #include <boost/type_traits.hpp>
 
-#ifdef __GNUC__
-# 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"
 
@@ -492,8 +491,7 @@ 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 {
+FOLLY_NAMESPACE_STD_BEGIN
 
 template <class C>
 struct hash<folly::basic_fbstring<C> > : private hash<const C*> {
@@ -509,8 +507,7 @@ struct hash<std::basic_string<C> > : private hash<const C*> {
   }
 };
 
-} // namespace __gnu_cxx
-#endif
+FOLLY_NAMESPACE_STD_END
 
 // Hook into boost's type traits
 namespace boost {