Harden failure signal handler in the face of memory corruptions
[folly.git] / folly / Traits.h
index 47092973cc8c5d7d911b2f16cd736ffc8ffe7870..966dcc578f7355e33cf8e8477c86f70dc67a3d24 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 <limits>
 #include <type_traits>
 
+#include "folly/Portability.h"
+
+// libc++ doesn't provide this header
+#if !FOLLY_USE_LIBCPP
+// This file appears in two locations: inside fbcode and in the
+// libstdc++ source code (when embedding fbstring as std::string).
+// To aid in this schizophrenic use, two macros are defined in
+// c++config.h:
+//   _LIBSTDCXX_FBSTRING - Set inside libstdc++.  This is useful to
+//      gate use inside fbcode v. libstdc++
 #include <bits/c++config.h>
+#endif
 
 #include <boost/type_traits.hpp>
 #include <boost/mpl/and.hpp>
@@ -223,7 +234,7 @@ template <class T> struct IsZeroInitializable
  * although that is not guaranteed by the standard.
  */
 
-namespace std {
+FOLLY_NAMESPACE_STD_BEGIN
 
 template <class T, class U>
   struct pair;
@@ -247,7 +258,7 @@ template <class K, class V, class C, class A>
 template <class T>
   class shared_ptr;
 
-}
+FOLLY_NAMESPACE_STD_END
 
 namespace boost {