Deprecate boost::mpl
authorYedidya Feldblum <yfeldblum@fb.com>
Tue, 3 May 2016 09:15:22 +0000 (02:15 -0700)
committerFacebook Github Bot 6 <facebook-github-bot-6-bot@fb.com>
Tue, 3 May 2016 09:20:21 +0000 (02:20 -0700)
Summary:
[Folly] Deprecate `boost::mpl`.

The `std` has equivalents; prefer them.

Reviewed By: Gownta

Differential Revision: D3247294

fb-gh-sync-id: 873697b7ea3ad069ff14662bc458a2e1cc840339
fbshipit-source-id: 873697b7ea3ad069ff14662bc458a2e1cc840339

folly/Traits.h
folly/small_vector.h

index 598a63a7d48b30b0910de9fb77cfec7da4737c91..45f005cb4443bb17ca8f968e907b6d342eca5720 100644 (file)
@@ -37,9 +37,7 @@
 #endif
 
 #include <boost/type_traits.hpp>
-#include <boost/mpl/and.hpp>
 #include <boost/mpl/has_xxx.hpp>
-#include <boost/mpl/not.hpp>
 
 namespace folly {
 
@@ -289,8 +287,9 @@ template <class T> class shared_ptr;
 
 template <class T, class U>
 struct has_nothrow_constructor< std::pair<T, U> >
-    : ::boost::mpl::and_< has_nothrow_constructor<T>,
-                          has_nothrow_constructor<U> > {};
+    : std::integral_constant<bool,
+        has_nothrow_constructor<T>::value &&
+        has_nothrow_constructor<U>::value> {};
 
 } // namespace boost
 
@@ -298,8 +297,10 @@ namespace folly {
 
 // STL commonly-used types
 template <class T, class U>
-struct IsRelocatable<  std::pair<T, U> >
-    : ::boost::mpl::and_< IsRelocatable<T>, IsRelocatable<U> > {};
+struct IsRelocatable< std::pair<T, U> >
+    : std::integral_constant<bool,
+        IsRelocatable<T>::value &&
+        IsRelocatable<U>::value> {};
 
 // Is T one of T1, T2, ..., Tn?
 template <class T, class... Ts>
index f77efb303cfcc7566753313937adb502d3e5d59d..827cf687230ae1319e0d81ac4673eed26a253839 100644 (file)
 #include <boost/mpl/empty.hpp>
 #include <boost/mpl/size.hpp>
 #include <boost/mpl/count.hpp>
-#include <boost/mpl/max.hpp>
 
 #include <folly/FormatTraits.h>
 #include <folly/Malloc.h>
 #include <folly/Portability.h>
+#include <folly/portability/Constexpr.h>
 #include <folly/portability/Malloc.h>
 
 #if defined(__GNUC__) && (FOLLY_X64 || FOLLY_PPC64)
@@ -355,10 +355,8 @@ class small_vector
    * into our value_type*, we will inline more than they asked.)
    */
   enum {
-    MaxInline = boost::mpl::max<
-                  boost::mpl::int_<sizeof(Value*) / sizeof(Value)>,
-                  boost::mpl::int_<RequestedMaxInline>
-                >::type::value
+    MaxInline =
+        constexpr_max(sizeof(Value*) / sizeof(Value), RequestedMaxInline),
   };
 
 public: