Electroneum
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 1796 of file gmock-matchers.h.

Constructor & Destructor Documentation

◆ MatcherAsPredicate()

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

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

Member Function Documentation

◆ operator()()

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

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

1807 {
1808 // We let matcher_ commit to a particular type here instead of
1809 // when the MatcherAsPredicate object was constructed. This
1810 // allows us to write Matches(m) where m is a polymorphic matcher
1811 // (e.g. Eq(5)).
1812 //
1813 // If we write Matcher<T>(matcher_).Matches(x) here, it won't
1814 // compile when matcher_ has type Matcher<const T&>; if we write
1815 // Matcher<const T&>(matcher_).Matches(x) here, it won't compile
1816 // when matcher_ has type Matcher<T>; if we just write
1817 // matcher_.Matches(x), it won't compile when matcher_ is
1818 // polymorphic, e.g. Eq(5).
1819 //
1820 // MatcherCast<const T&>() is necessary for making the code work
1821 // in all of the above situations.
1822 return MatcherCast<const T&>(matcher_).Matches(x);
1823 }
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:
  • /home/abuild/rpmbuild/BUILD/electroneum-5.1.3.1-build/electroneum-5.1.3.1/external/rapidjson/thirdparty/gtest/googlemock/include/gmock/gmock-matchers.h