MCPcopy Create free account
hub / github.com/awslabs/aws-lambda-cpp / ComparisonBase

Class ComparisonBase

tests/gtest/gtest.h:9432–9467  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

9430// a "bare" type (i.e. neither 'const T' nor 'T&').
9431template <typename D, typename Rhs, typename Op>
9432class ComparisonBase {
9433 public:
9434 explicit ComparisonBase(const Rhs& rhs) : rhs_(rhs) {}
9435 template <typename Lhs>
9436 operator Matcher<Lhs>() const {
9437 return Matcher<Lhs>(new Impl<const Lhs&>(rhs_));
9438 }
9439
9440 private:
9441 template <typename T>
9442 static const T& Unwrap(const T& v) { return v; }
9443 template <typename T>
9444 static const T& Unwrap(std::reference_wrapper<T> v) { return v; }
9445
9446 template <typename Lhs, typename = Rhs>
9447 class Impl : public MatcherInterface<Lhs> {
9448 public:
9449 explicit Impl(const Rhs& rhs) : rhs_(rhs) {}
9450 bool MatchAndExplain(Lhs lhs,
9451 MatchResultListener* /* listener */) const override {
9452 return Op()(lhs, Unwrap(rhs_));
9453 }
9454 void DescribeTo(::std::ostream* os) const override {
9455 *os << D::Desc() << " ";
9456 UniversalPrint(Unwrap(rhs_), os);
9457 }
9458 void DescribeNegationTo(::std::ostream* os) const override {
9459 *os << D::NegatedDesc() << " ";
9460 UniversalPrint(Unwrap(rhs_), os);
9461 }
9462
9463 private:
9464 Rhs rhs_;
9465 };
9466 Rhs rhs_;
9467};
9468
9469template <typename Rhs>
9470class EqMatcher : public ComparisonBase<EqMatcher<Rhs>, Rhs, AnyEq> {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected