Commit 79d908dd authored by Joe Loser's avatar Joe Loser Committed by Facebook Github Bot

Simplify HasArgumentTypes in DynamicParser-inl.h (#1086)

Summary:
- `HasArgumentTypes` uses nested `boost::mpl::transform` calls to strip
  reference qualifiers from the function argument types and then another
  `mpl::transform` call to remove `const` qualifiers.
- Replace the nested `mpl::transform` calls to just one call by using
  `folly::remove_cvref`.
Pull Request resolved: https://github.com/facebook/folly/pull/1086

Reviewed By: Orvid

Differential Revision: D14638843

Pulled By: yfeldblum

fbshipit-source-id: 8c360e50ffaba0328aa8e4c86245ce25d45bc01b
parent 46183b6c
......@@ -33,6 +33,7 @@
#include <boost/mpl/vector.hpp>
#include <folly/Conv.h>
#include <folly/Traits.h>
namespace folly {
......@@ -79,17 +80,13 @@ using ArgumentTypes =
typename ArgumentTypesByKind<IdentifyCallable::getKind<Fn>(), Fn>::type;
// At present, works for lambdas or plain old functions, but can be
// extended. The comparison deliberately strips cv-qualifieers and
// extended. The comparison deliberately strips cv-qualifiers and
// reference, leaving that choice up to the caller.
template <typename Fn, typename... Args>
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,
typename boost::mpl::
transform<ArgumentTypes<Fn>, remove_cvref<boost::mpl::_1>>::type,
boost::mpl::vector<Args...>>::type {};
template <typename... Args>
using EnableForArgTypes =
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment