Adds mutable_impl() and impl() to PolymorphicMatcher (by Zhanyong Wan); Enables gMock to compile with VC 7.1 (by Vlad Losev).

This commit is contained in:
zhanyong.wan
2009-08-31 23:51:23 +00:00
parent 0ea67f88ae
commit 2b43a9ecd1
5 changed files with 65 additions and 50 deletions

View File

@@ -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 <typename T>
operator Matcher<T>() const {
return Matcher<T>(new MonomorphicImpl<T>(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