diff options
author | Abseil Team <absl-team@google.com> | 2021-05-13 15:57:24 (GMT) |
---|---|---|
committer | CJ Johnson <johnsoncj@google.com> | 2021-05-13 19:08:57 (GMT) |
commit | 662fe38e44900c007eccb65a5d2ea19df7bd520e (patch) | |
tree | 2148e950225e042f49d2634c6c312e7653c536fc /googlemock/include | |
parent | d69a112956a700fefdfed9fc87a8c2568ec83407 (diff) | |
download | googletest-662fe38e44900c007eccb65a5d2ea19df7bd520e.zip googletest-662fe38e44900c007eccb65a5d2ea19df7bd520e.tar.gz googletest-662fe38e44900c007eccb65a5d2ea19df7bd520e.tar.bz2 |
Googletest export
Support templating MockFunction over function objects besides std::function.
PiperOrigin-RevId: 373586967
Diffstat (limited to 'googlemock/include')
-rw-r--r-- | googlemock/include/gmock/gmock-spec-builders.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/googlemock/include/gmock/gmock-spec-builders.h b/googlemock/include/gmock/gmock-spec-builders.h index f1bd79c..41323c1 100644 --- a/googlemock/include/gmock/gmock-spec-builders.h +++ b/googlemock/include/gmock/gmock-spec-builders.h @@ -1838,12 +1838,12 @@ corresponding to the provided F argument. It makes use of MockFunction easier by allowing it to accept more F arguments than just function signatures. -Specializations provided here cover only a signature type itself and -std::function. However, if need be it can be easily extended to cover also other -types (like for example boost::function). +Specializations provided here cover a signature type itself and any template +that can be parameterized with a signature, including std::function and +boost::function. */ -template <typename F> +template <typename F, typename = void> struct SignatureOf; template <typename R, typename... Args> @@ -1851,8 +1851,10 @@ struct SignatureOf<R(Args...)> { using type = R(Args...); }; -template <typename F> -struct SignatureOf<std::function<F>> : SignatureOf<F> {}; +template <template <typename> class C, typename F> +struct SignatureOf<C<F>, + typename std::enable_if<std::is_function<F>::value>::type> + : SignatureOf<F> {}; template <typename F> using SignatureOfT = typename SignatureOf<F>::type; |