Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
testing::internal::MatcherAsPredicate< M > Class Template Reference

#include <gmock-matchers.h>

Public Member Functions

 MatcherAsPredicate (M matcher)
 
template<typename T >
bool operator() (const T &x) const
 

Detailed Description

template<typename M>
class testing::internal::MatcherAsPredicate< M >

Definition at line 1992 of file gmock-matchers.h.

Constructor & Destructor Documentation

◆ MatcherAsPredicate()

template<typename M >
testing::internal::MatcherAsPredicate< M >::MatcherAsPredicate ( M matcher)
inlineexplicit

Definition at line 1994 of file gmock-matchers.h.

1994: matcher_(matcher) {}

Member Function Documentation

◆ operator()()

template<typename M >
template<typename T >
bool testing::internal::MatcherAsPredicate< M >::operator() ( const T & x) const
inline

Definition at line 2003 of file gmock-matchers.h.

2003 {
2004 // We let matcher_ commit to a particular type here instead of
2005 // when the MatcherAsPredicate object was constructed. This
2006 // allows us to write Matches(m) where m is a polymorphic matcher
2007 // (e.g. Eq(5)).
2008 //
2009 // If we write Matcher<T>(matcher_).Matches(x) here, it won't
2010 // compile when matcher_ has type Matcher<const T&>; if we write
2011 // Matcher<const T&>(matcher_).Matches(x) here, it won't compile
2012 // when matcher_ has type Matcher<T>; if we just write
2013 // matcher_.Matches(x), it won't compile when matcher_ is
2014 // polymorphic, e.g. Eq(5).
2015 //
2016 // MatcherCast<const T&>() is necessary for making the code work
2017 // in all of the above situations.
2018 return MatcherCast<const T&>(matcher_).Matches(x);
2019 }
Matcher< T > MatcherCast(const M &matcher)
Here is the call graph for this function:

The documentation for this class was generated from the following file: