Work around an MSVC expression SFINAE bug in DynamicParser
authorChristopher Dykes <cdykes@fb.com>
Mon, 21 Nov 2016 23:40:54 +0000 (15:40 -0800)
committerFacebook Github Bot <facebook-github-bot-bot@fb.com>
Mon, 21 Nov 2016 23:53:33 +0000 (15:53 -0800)
Summary: The good news is that it's cleaner than it was to start with.

Reviewed By: yfeldblum

Differential Revision: D4215323

fbshipit-source-id: 6758092f1e76f60b360753026bb7716737a51304

folly/experimental/DynamicParser-inl.h

index f3dc0c3548985426bca80949c1327cc118b5e6fa..df390b74f2a5ccc0ee83c0b90605a672f527d7c4 100644 (file)
@@ -77,22 +77,18 @@ using ArgumentTypes =
 // extended.  The comparison deliberately strips cv-qualifieers and
 // reference, leaving that choice up to the caller.
 template <typename Fn, typename... Args>
-constexpr bool hasArgumentTypes() {
-  using HasArgumentTypes = typename boost::mpl::template equal<
-    typename boost::mpl::template transform<
-      typename boost::mpl::template transform<
-        ArgumentTypes<Fn>,
-        typename std::template remove_reference<boost::mpl::_1>
-      >::type,
-      typename std::template remove_cv<boost::mpl::_1>
-    >::type,
-    boost::mpl::vector<Args...>
-  >::type;
-  return HasArgumentTypes::value;
-}
+struct HasArgumentTypes
+    : boost::mpl::template equal<
+          typename boost::mpl::template transform<
+              typename boost::mpl::template transform<
+                  ArgumentTypes<Fn>,
+                  typename std::template remove_reference<boost::mpl::_1>>::
+                  type,
+              typename std::template remove_cv<boost::mpl::_1>>::type,
+          boost::mpl::vector<Args...>>::type {};
 template <typename... Args>
 using EnableForArgTypes =
-  typename std::enable_if<hasArgumentTypes<Args...>(), void>::type;
+    typename std::enable_if<HasArgumentTypes<Args...>::value, void>::type;
 
 // No arguments
 template <typename Fn> EnableForArgTypes<Fn>