From 2b43a9ecd16edc1ec55429967e0f2de1aaf8e8bb Mon Sep 17 00:00:00 2001 From: "zhanyong.wan" Date: Mon, 31 Aug 2009 23:51:23 +0000 Subject: Adds mutable_impl() and impl() to PolymorphicMatcher (by Zhanyong Wan); Enables gMock to compile with VC 7.1 (by Vlad Losev). --- include/gmock/gmock-matchers.h | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'include/gmock/gmock-matchers.h') diff --git a/include/gmock/gmock-matchers.h b/include/gmock/gmock-matchers.h index 9e97866a..7266fba7 100644 --- a/include/gmock/gmock-matchers.h +++ b/include/gmock/gmock-matchers.h @@ -236,6 +236,14 @@ class PolymorphicMatcher { public: explicit PolymorphicMatcher(const Impl& impl) : impl_(impl) {} + // Returns a mutable reference to the underlying matcher + // implementation object. + Impl& mutable_impl() { return impl_; } + + // Returns an immutable reference to the underlying matcher + // implementation object. + const Impl& impl() const { return impl_; } + template operator Matcher() const { return Matcher(new MonomorphicImpl(impl_)); @@ -273,11 +281,12 @@ class PolymorphicMatcher { // doesn't need to customize it. ExplainMatchResultTo(impl_, x, os); } + private: const Impl impl_; }; - const Impl impl_; + Impl impl_; }; // Creates a matcher from its implementation. This is easier to use -- cgit v1.2.3