summaryrefslogtreecommitdiffstats
path: root/googlemock/include/gmock/gmock-actions.h
diff options
context:
space:
mode:
authorAbseil Team <absl-team@google.com>2020-09-17 15:02:40 (GMT)
committerGennadiy Rozental <rogeeff@google.com>2020-09-20 22:48:32 (GMT)
commitbb2725346db5e19da905ddfdeb02bfba08b4fd74 (patch)
tree2a8f20f33650c82879ca6cdd6ba6909603d0e8b0 /googlemock/include/gmock/gmock-actions.h
parenta4ab0abb93620ce26efad9de9296b73b16e88588 (diff)
downloadgoogletest-bb2725346db5e19da905ddfdeb02bfba08b4fd74.zip
googletest-bb2725346db5e19da905ddfdeb02bfba08b4fd74.tar.gz
googletest-bb2725346db5e19da905ddfdeb02bfba08b4fd74.tar.bz2
Googletest export
Reduce the demangled name bloat of the Action constructor. PiperOrigin-RevId: 332234887
Diffstat (limited to 'googlemock/include/gmock/gmock-actions.h')
-rw-r--r--googlemock/include/gmock/gmock-actions.h17
1 files changed, 9 insertions, 8 deletions
diff --git a/googlemock/include/gmock/gmock-actions.h b/googlemock/include/gmock/gmock-actions.h
index cdff694..02b17c7 100644
--- a/googlemock/include/gmock/gmock-actions.h
+++ b/googlemock/include/gmock/gmock-actions.h
@@ -449,6 +449,9 @@ class Action {
}
};
+ template <typename G>
+ using IsCompatibleFunctor = std::is_constructible<std::function<F>, G>;
+
public:
typedef typename internal::Function<F>::Result Result;
typedef typename internal::Function<F>::ArgumentTuple ArgumentTuple;
@@ -460,15 +463,13 @@ class Action {
// Construct an Action from a specified callable.
// This cannot take std::function directly, because then Action would not be
// directly constructible from lambda (it would require two conversions).
- template <typename G,
- typename IsCompatibleFunctor =
- ::std::is_constructible<::std::function<F>, G>,
- typename IsNoArgsFunctor =
- ::std::is_constructible<::std::function<Result()>, G>,
- typename = typename ::std::enable_if<internal::disjunction<
- IsCompatibleFunctor, IsNoArgsFunctor>::value>::type>
+ template <
+ typename G,
+ typename = typename std::enable_if<internal::disjunction<
+ IsCompatibleFunctor<G>, std::is_constructible<std::function<Result()>,
+ G>>::value>::type>
Action(G&& fun) { // NOLINT
- Init(::std::forward<G>(fun), IsCompatibleFunctor());
+ Init(::std::forward<G>(fun), IsCompatibleFunctor<G>());
}
// Constructs an Action from its implementation.