diff options
author | vladlosev <vladlosev@8415998a-534a-0410-bf83-d39667b30386> | 2009-11-18 00:43:37 +0000 |
---|---|---|
committer | vladlosev <vladlosev@8415998a-534a-0410-bf83-d39667b30386> | 2009-11-18 00:43:37 +0000 |
commit | 79b83505bcf73bf2903ebf2e2f82cb1e1f181816 (patch) | |
tree | 56889fedd603bae573b178494084d00d7f5da379 /include | |
parent | a63be0bd91ebbcb33635b1730a8cd8cb70fb3733 (diff) | |
download | googletest-79b83505bcf73bf2903ebf2e2f82cb1e1f181816.tar.gz googletest-79b83505bcf73bf2903ebf2e2f82cb1e1f181816.tar.bz2 googletest-79b83505bcf73bf2903ebf2e2f82cb1e1f181816.zip |
Updates IsNull and NotNull matchers to work with smart pointers.
Diffstat (limited to 'include')
-rw-r--r-- | include/gmock/gmock-matchers.h | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/include/gmock/gmock-matchers.h b/include/gmock/gmock-matchers.h index 3d82279b..deb09463 100644 --- a/include/gmock/gmock-matchers.h +++ b/include/gmock/gmock-matchers.h @@ -633,12 +633,12 @@ GMOCK_IMPLEMENT_COMPARISON_MATCHER_(Ne, !=, "not equal to"); #undef GMOCK_IMPLEMENT_COMPARISON_MATCHER_ -// Implements the polymorphic IsNull() matcher, which matches any +// Implements the polymorphic IsNull() matcher, which matches any raw or smart // pointer that is NULL. class IsNullMatcher { public: - template <typename T> - bool Matches(T* p) const { return p == NULL; } + template <typename Pointer> + bool Matches(const Pointer& p) const { return GetRawPointer(p) == NULL; } void DescribeTo(::std::ostream* os) const { *os << "is NULL"; } void DescribeNegationTo(::std::ostream* os) const { @@ -646,12 +646,12 @@ class IsNullMatcher { } }; -// Implements the polymorphic NotNull() matcher, which matches any +// Implements the polymorphic NotNull() matcher, which matches any raw or smart // pointer that is not NULL. class NotNullMatcher { public: - template <typename T> - bool Matches(T* p) const { return p != NULL; } + template <typename Pointer> + bool Matches(const Pointer& p) const { return GetRawPointer(p) != NULL; } void DescribeTo(::std::ostream* os) const { *os << "is not NULL"; } void DescribeNegationTo(::std::ostream* os) const { |