diff options
author | Abseil Team <absl-team@google.com> | 2022-07-29 00:14:35 (GMT) |
---|---|---|
committer | Copybara-Service <copybara-worker@google.com> | 2022-07-29 00:15:30 (GMT) |
commit | dd7a9d29a33de34836c345c3b753d4eba15c5f44 (patch) | |
tree | 5cc66eb50715217b2cb121a63f11594acb24d244 /googlemock/include/gmock | |
parent | 3bc8fb37232e0d51c2ce80094ea25ef6bf416187 (diff) | |
download | googletest-dd7a9d29a33de34836c345c3b753d4eba15c5f44.zip googletest-dd7a9d29a33de34836c345c3b753d4eba15c5f44.tar.gz googletest-dd7a9d29a33de34836c345c3b753d4eba15c5f44.tar.bz2 |
Add support of 18-member structs to gmock UnpackStructImpl.refs/pull/3966/head
PiperOrigin-RevId: 463961734
Change-Id: Ib62e320a745c190955f181c1f4f12e4cd407ef22
Diffstat (limited to 'googlemock/include/gmock')
-rw-r--r-- | googlemock/include/gmock/gmock-matchers.h | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h index 3c8cc32..f45ace1 100644 --- a/googlemock/include/gmock/gmock-matchers.h +++ b/googlemock/include/gmock/gmock-matchers.h @@ -3240,6 +3240,11 @@ auto UnpackStructImpl(const T& t, MakeIndexSequence<17>, char) { const auto& [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q] = t; return std::tie(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q); } +template <typename T> +auto UnpackStructImpl(const T& t, MakeIndexSequence<18>, char) { + const auto& [a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r] = t; + return std::tie(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r); +} #endif // defined(__cpp_structured_bindings) template <size_t I, typename T> @@ -3306,8 +3311,8 @@ class FieldsAreMatcherImpl<Struct, IndexSequence<I...>> std::vector<StringMatchResultListener> inner_listener(sizeof...(I)); VariadicExpand( - {failed_pos == ~size_t{} && !std::get<I>(matchers_).MatchAndExplain( - std::get<I>(tuple), &inner_listener[I]) + {failed_pos == ~size_t{}&& !std::get<I>(matchers_).MatchAndExplain( + std::get<I>(tuple), &inner_listener[I]) ? failed_pos = I : 0 ...}); if (failed_pos != ~size_t{}) { |