diff options
author | Abseil Team <absl-team@google.com> | 2019-01-07 22:06:16 (GMT) |
---|---|---|
committer | gennadiycivil <misterg@google.com> | 2019-01-08 16:50:56 (GMT) |
commit | 216c37f057ae0fff38062984c890df912f40ccf6 (patch) | |
tree | 19bd4362670a0c0440f08b0360eaca8a5e44d9ed /googlemock/include/gmock/internal/gmock-internal-utils.h | |
parent | 644319b9f06f6ca9bf69fe791be399061044bc3d (diff) | |
download | googletest-216c37f057ae0fff38062984c890df912f40ccf6.zip googletest-216c37f057ae0fff38062984c890df912f40ccf6.tar.gz googletest-216c37f057ae0fff38062984c890df912f40ccf6.tar.bz2 |
Googletest export
Drop generated file gmock-generated-internal-utils.h.
PiperOrigin-RevId: 228232195
Diffstat (limited to 'googlemock/include/gmock/internal/gmock-internal-utils.h')
-rw-r--r-- | googlemock/include/gmock/internal/gmock-internal-utils.h | 36 |
1 files changed, 35 insertions, 1 deletions
diff --git a/googlemock/include/gmock/internal/gmock-internal-utils.h b/googlemock/include/gmock/internal/gmock-internal-utils.h index 7ebd645..661c835 100644 --- a/googlemock/include/gmock/internal/gmock-internal-utils.h +++ b/googlemock/include/gmock/internal/gmock-internal-utils.h @@ -42,11 +42,14 @@ #include <stdio.h> #include <ostream> // NOLINT #include <string> -#include "gmock/internal/gmock-generated-internal-utils.h" #include "gmock/internal/gmock-port.h" #include "gtest/gtest.h" namespace testing { + +template <typename> +class Matcher; + namespace internal { // Silence MSVC C4100 (unreferenced formal parameter) and @@ -525,6 +528,37 @@ auto Apply(F&& f, Tuple&& args) make_int_pack<std::tuple_size<Tuple>::value>()); } +// Template struct Function<F>, where F must be a function type, contains +// the following typedefs: +// +// Result: the function's return type. +// Arg<N>: the type of the N-th argument, where N starts with 0. +// ArgumentTuple: the tuple type consisting of all parameters of F. +// ArgumentMatcherTuple: the tuple type consisting of Matchers for all +// parameters of F. +// MakeResultVoid: the function type obtained by substituting void +// for the return type of F. +// MakeResultIgnoredValue: +// the function type obtained by substituting Something +// for the return type of F. +template <typename T> +struct Function; + +template <typename R, typename... Args> +struct Function<R(Args...)> { + using Result = R; + static constexpr size_t ArgumentCount = sizeof...(Args); + template <size_t I> + using Arg = ElemFromList<I, typename MakeIndexSequence<sizeof...(Args)>::type, + Args...>; + using ArgumentTuple = std::tuple<Args...>; + using ArgumentMatcherTuple = std::tuple<Matcher<Args>...>; + using MakeResultVoid = void(Args...); + using MakeResultIgnoredValue = IgnoredValue(Args...); +}; + +template <typename R, typename... Args> +constexpr size_t Function<R(Args...)>::ArgumentCount; #ifdef _MSC_VER # pragma warning(pop) |