diff options
author | Abseil Team <absl-team@google.com> | 2018-12-15 13:11:02 (GMT) |
---|---|---|
committer | Mark Barolak <mbar@google.com> | 2018-12-17 18:53:33 (GMT) |
commit | 1ec20f87e390e1d711e69b69345e68a1fa656bbc (patch) | |
tree | e859ddc35cf3d0322e97907b9c6a4b6c0cd5b6a4 /googlemock/include | |
parent | 096fb37a1976bbddde136c9db5fa88ac4332b802 (diff) | |
download | googletest-1ec20f87e390e1d711e69b69345e68a1fa656bbc.zip googletest-1ec20f87e390e1d711e69b69345e68a1fa656bbc.tar.gz googletest-1ec20f87e390e1d711e69b69345e68a1fa656bbc.tar.bz2 |
Googletest export
Allow container matchers to accept move-only containers.
PiperOrigin-RevId: 225667441
Diffstat (limited to 'googlemock/include')
-rw-r--r-- | googlemock/include/gmock/gmock-matchers.h | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/googlemock/include/gmock/gmock-matchers.h b/googlemock/include/gmock/gmock-matchers.h index 68278be..fa89bd6 100644 --- a/googlemock/include/gmock/gmock-matchers.h +++ b/googlemock/include/gmock/gmock-matchers.h @@ -1959,7 +1959,7 @@ class SizeIsMatcher { template <typename Container> operator Matcher<Container>() const { - return MakeMatcher(new Impl<Container>(size_matcher_)); + return Matcher<Container>(new Impl<const Container&>(size_matcher_)); } template <typename Container> @@ -2009,7 +2009,7 @@ class BeginEndDistanceIsMatcher { template <typename Container> operator Matcher<Container>() const { - return MakeMatcher(new Impl<Container>(distance_matcher_)); + return Matcher<Container>(new Impl<const Container&>(distance_matcher_)); } template <typename Container> @@ -2269,7 +2269,8 @@ class PointwiseMatcher { !IsHashTable<GTEST_REMOVE_REFERENCE_AND_CONST_(LhsContainer)>::value, use_UnorderedPointwise_with_hash_tables); - return MakeMatcher(new Impl<LhsContainer>(tuple_matcher_, rhs_)); + return Matcher<LhsContainer>( + new Impl<const LhsContainer&>(tuple_matcher_, rhs_)); } template <typename LhsContainer> @@ -2471,7 +2472,8 @@ class ContainsMatcher { template <typename Container> operator Matcher<Container>() const { - return MakeMatcher(new ContainsMatcherImpl<Container>(inner_matcher_)); + return Matcher<Container>( + new ContainsMatcherImpl<const Container&>(inner_matcher_)); } private: @@ -2488,7 +2490,8 @@ class EachMatcher { template <typename Container> operator Matcher<Container>() const { - return MakeMatcher(new EachMatcherImpl<Container>(inner_matcher_)); + return Matcher<Container>( + new EachMatcherImpl<const Container&>(inner_matcher_)); } private: @@ -3086,8 +3089,10 @@ class UnorderedElementsAreMatcher { matchers.reserve(::std::tuple_size<MatcherTuple>::value); TransformTupleValues(CastAndAppendTransform<const Element&>(), matchers_, ::std::back_inserter(matchers)); - return MakeMatcher(new UnorderedElementsAreMatcherImpl<Container>( - UnorderedMatcherRequire::ExactMatch, matchers.begin(), matchers.end())); + return Matcher<Container>( + new UnorderedElementsAreMatcherImpl<const Container&>( + UnorderedMatcherRequire::ExactMatch, matchers.begin(), + matchers.end())); } private: @@ -3116,8 +3121,8 @@ class ElementsAreMatcher { matchers.reserve(::std::tuple_size<MatcherTuple>::value); TransformTupleValues(CastAndAppendTransform<const Element&>(), matchers_, ::std::back_inserter(matchers)); - return MakeMatcher(new ElementsAreMatcherImpl<Container>( - matchers.begin(), matchers.end())); + return Matcher<Container>(new ElementsAreMatcherImpl<const Container&>( + matchers.begin(), matchers.end())); } private: @@ -3136,8 +3141,9 @@ class UnorderedElementsAreArrayMatcher { template <typename Container> operator Matcher<Container>() const { - return MakeMatcher(new UnorderedElementsAreMatcherImpl<Container>( - match_flags_, matchers_.begin(), matchers_.end())); + return Matcher<Container>( + new UnorderedElementsAreMatcherImpl<const Container&>( + match_flags_, matchers_.begin(), matchers_.end())); } private: @@ -3160,7 +3166,7 @@ class ElementsAreArrayMatcher { !IsHashTable<GTEST_REMOVE_REFERENCE_AND_CONST_(Container)>::value, use_UnorderedElementsAreArray_with_hash_tables); - return MakeMatcher(new ElementsAreMatcherImpl<Container>( + return Matcher<Container>(new ElementsAreMatcherImpl<const Container&>( matchers_.begin(), matchers_.end())); } |