diff options
Diffstat (limited to 'googletest/include/gtest/gtest-matchers.h')
-rw-r--r-- | googletest/include/gtest/gtest-matchers.h | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/googletest/include/gtest/gtest-matchers.h b/googletest/include/gtest/gtest-matchers.h index 9bcf5ac2..02a9952b 100644 --- a/googletest/include/gtest/gtest-matchers.h +++ b/googletest/include/gtest/gtest-matchers.h @@ -256,13 +256,12 @@ class MatcherBase { public: // Returns true iff the matcher matches x; also explains the match // result to 'listener'. - bool MatchAndExplain(GTEST_REFERENCE_TO_CONST_(T) x, - MatchResultListener* listener) const { + bool MatchAndExplain(const T& x, MatchResultListener* listener) const { return impl_->MatchAndExplain(x, listener); } // Returns true iff this matcher matches x. - bool Matches(GTEST_REFERENCE_TO_CONST_(T) x) const { + bool Matches(const T& x) const { DummyMatchResultListener dummy; return MatchAndExplain(x, &dummy); } @@ -276,8 +275,7 @@ class MatcherBase { } // Explains why x matches, or doesn't match, the matcher. - void ExplainMatchResultTo(GTEST_REFERENCE_TO_CONST_(T) x, - ::std::ostream* os) const { + void ExplainMatchResultTo(const T& x, ::std::ostream* os) const { StreamMatchResultListener listener(os); MatchAndExplain(x, &listener); } @@ -293,22 +291,19 @@ class MatcherBase { MatcherBase() {} // Constructs a matcher from its implementation. - explicit MatcherBase( - const MatcherInterface<GTEST_REFERENCE_TO_CONST_(T)>* impl) - : impl_(impl) {} + explicit MatcherBase(const MatcherInterface<const T&>* impl) : impl_(impl) {} template <typename U> explicit MatcherBase( const MatcherInterface<U>* impl, typename internal::EnableIf< - !internal::IsSame<U, GTEST_REFERENCE_TO_CONST_(U)>::value>::type* = - nullptr) + !internal::IsSame<U, const U&>::value>::type* = nullptr) : impl_(new internal::MatcherInterfaceAdapter<U>(impl)) {} virtual ~MatcherBase() {} private: - std::shared_ptr<const MatcherInterface<GTEST_REFERENCE_TO_CONST_(T)>> impl_; + std::shared_ptr<const MatcherInterface<const T&>> impl_; }; } // namespace internal @@ -326,15 +321,13 @@ class Matcher : public internal::MatcherBase<T> { explicit Matcher() {} // NOLINT // Constructs a matcher from its implementation. - explicit Matcher(const MatcherInterface<GTEST_REFERENCE_TO_CONST_(T)>* impl) + explicit Matcher(const MatcherInterface<const T&>* impl) : internal::MatcherBase<T>(impl) {} template <typename U> - explicit Matcher( - const MatcherInterface<U>* impl, - typename internal::EnableIf< - !internal::IsSame<U, GTEST_REFERENCE_TO_CONST_(U)>::value>::type* = - nullptr) + explicit Matcher(const MatcherInterface<U>* impl, + typename internal::EnableIf< + !internal::IsSame<U, const U&>::value>::type* = nullptr) : internal::MatcherBase<T>(impl) {} // Implicit constructor here allows people to write @@ -535,7 +528,7 @@ class PolymorphicMatcher { template <typename T> operator Matcher<T>() const { - return Matcher<T>(new MonomorphicImpl<GTEST_REFERENCE_TO_CONST_(T)>(impl_)); + return Matcher<T>(new MonomorphicImpl<const T&>(impl_)); } private: |