Commit bb272534 authored by Abseil Team's avatar Abseil Team Committed by Gennadiy Rozental
Browse files

Googletest export

Reduce the demangled name bloat of the Action constructor.

PiperOrigin-RevId: 332234887
parent a4ab0abb
...@@ -449,6 +449,9 @@ class Action { ...@@ -449,6 +449,9 @@ class Action {
} }
}; };
template <typename G>
using IsCompatibleFunctor = std::is_constructible<std::function<F>, G>;
public: public:
typedef typename internal::Function<F>::Result Result; typedef typename internal::Function<F>::Result Result;
typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple; typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
...@@ -460,15 +463,13 @@ class Action { ...@@ -460,15 +463,13 @@ class Action {
// Construct an Action from a specified callable. // Construct an Action from a specified callable.
// This cannot take std::function directly, because then Action would not be // This cannot take std::function directly, because then Action would not be
// directly constructible from lambda (it would require two conversions). // directly constructible from lambda (it would require two conversions).
template <typename G, template <
typename IsCompatibleFunctor = typename G,
::std::is_constructible<::std::function<F>, G>, typename = typename std::enable_if<internal::disjunction<
typename IsNoArgsFunctor = IsCompatibleFunctor<G>, std::is_constructible<std::function<Result()>,
::std::is_constructible<::std::function<Result()>, G>, G>>::value>::type>
typename = typename ::std::enable_if<internal::disjunction<
IsCompatibleFunctor, IsNoArgsFunctor>::value>::type>
Action(G&& fun) { // NOLINT Action(G&& fun) { // NOLINT
Init(::std::forward<G>(fun), IsCompatibleFunctor()); Init(::std::forward<G>(fun), IsCompatibleFunctor<G>());
} }
// Constructs an Action from its implementation. // Constructs an Action from its implementation.
......
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