mirror of
https://github.com/google/googletest.git
synced 2025-12-09 08:55:48 +08:00
Googletest export
Remove GTEST_REFERENCE_TO_CONST_ usage from GMock. In C++11, it's redundant. PiperOrigin-RevId: 225719210
This commit is contained in:
committed by
Mark Barolak
parent
1ec20f87e3
commit
b7dd66519f
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user