proxygen
testing::internal::MatcherCastImpl< T, M > Class Template Reference

#include <gmock-matchers.h>

Static Public Member Functions

static Matcher< TCast (const M &polymorphic_matcher_or_value)
 
static Matcher< TCast (const M &polymorphic_matcher_or_value)
 
static Matcher< TCast (const M &polymorphic_matcher_or_value)
 

Static Private Member Functions

static Matcher< TCastImpl (const M &value, BooleanConstant< false >)
 
static Matcher< TCastImpl (const M &polymorphic_matcher_or_value, BooleanConstant< true >)
 
static Matcher< TCastImpl (const M &value, BooleanConstant< false >)
 
static Matcher< TCastImpl (const M &polymorphic_matcher_or_value, BooleanConstant< true >)
 
static Matcher< TCastImpl (const M &value, BooleanConstant< false >)
 
static Matcher< TCastImpl (const M &polymorphic_matcher_or_value, BooleanConstant< true >)
 

Detailed Description

template<typename T, typename M>
class testing::internal::MatcherCastImpl< T, M >

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

Member Function Documentation

template<typename T , typename M >
static Matcher<T> testing::internal::MatcherCastImpl< T, M >::Cast ( const M polymorphic_matcher_or_value)
inlinestatic

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

References M, and value.

Referenced by testing::internal::MatcherCastImpl< T, Matcher< T > >::Cast(), testing::SafeMatcherCastImpl< T >::Cast(), and testing::MatcherCast().

517  {
518  // M can be a polymorhic matcher, in which case we want to use
519  // its conversion operator to create Matcher<T>. Or it can be a value
520  // that should be passed to the Matcher<T>'s constructor.
521  //
522  // We can't call Matcher<T>(polymorphic_matcher_or_value) when M is a
523  // polymorphic matcher because it'll be ambiguous if T has an implicit
524  // constructor from M (this usually happens when T has an implicit
525  // constructor from any type).
526  //
527  // It won't work to unconditionally implict_cast
528  // polymorphic_matcher_or_value to Matcher<T> because it won't trigger
529  // a user-defined conversion from M to T if one exists (assuming M is
530  // a value).
531  return CastImpl(
532  polymorphic_matcher_or_value,
533  BooleanConstant<
534  internal::ImplicitlyConvertible<M, Matcher<T> >::value>());
535  }
static Matcher< T > CastImpl(const M &value, BooleanConstant< false >)
static const char *const value
Definition: Conv.cpp:50
**Optimized Holders **The template hazptr_array< M > provides most of the functionality *of M hazptr_holder s but with faster construction destruction *for M
Definition: Hazptr.h:104
template<typename T , typename M >
static Matcher<T> testing::internal::MatcherCastImpl< T, M >::Cast ( const M polymorphic_matcher_or_value)
inlinestatic

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

References M, and value.

517  {
518  // M can be a polymorhic matcher, in which case we want to use
519  // its conversion operator to create Matcher<T>. Or it can be a value
520  // that should be passed to the Matcher<T>'s constructor.
521  //
522  // We can't call Matcher<T>(polymorphic_matcher_or_value) when M is a
523  // polymorphic matcher because it'll be ambiguous if T has an implicit
524  // constructor from M (this usually happens when T has an implicit
525  // constructor from any type).
526  //
527  // It won't work to unconditionally implict_cast
528  // polymorphic_matcher_or_value to Matcher<T> because it won't trigger
529  // a user-defined conversion from M to T if one exists (assuming M is
530  // a value).
531  return CastImpl(
532  polymorphic_matcher_or_value,
533  BooleanConstant<
534  internal::ImplicitlyConvertible<M, Matcher<T> >::value>());
535  }
static Matcher< T > CastImpl(const M &value, BooleanConstant< false >)
static const char *const value
Definition: Conv.cpp:50
**Optimized Holders **The template hazptr_array< M > provides most of the functionality *of M hazptr_holder s but with faster construction destruction *for M
Definition: Hazptr.h:104
template<typename T , typename M >
static Matcher<T> testing::internal::MatcherCastImpl< T, M >::Cast ( const M polymorphic_matcher_or_value)
inlinestatic

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

References M, and value.

517  {
518  // M can be a polymorhic matcher, in which case we want to use
519  // its conversion operator to create Matcher<T>. Or it can be a value
520  // that should be passed to the Matcher<T>'s constructor.
521  //
522  // We can't call Matcher<T>(polymorphic_matcher_or_value) when M is a
523  // polymorphic matcher because it'll be ambiguous if T has an implicit
524  // constructor from M (this usually happens when T has an implicit
525  // constructor from any type).
526  //
527  // It won't work to unconditionally implict_cast
528  // polymorphic_matcher_or_value to Matcher<T> because it won't trigger
529  // a user-defined conversion from M to T if one exists (assuming M is
530  // a value).
531  return CastImpl(
532  polymorphic_matcher_or_value,
533  BooleanConstant<
534  internal::ImplicitlyConvertible<M, Matcher<T> >::value>());
535  }
static Matcher< T > CastImpl(const M &value, BooleanConstant< false >)
static const char *const value
Definition: Conv.cpp:50
**Optimized Holders **The template hazptr_array< M > provides most of the functionality *of M hazptr_holder s but with faster construction destruction *for M
Definition: Hazptr.h:104
template<typename T , typename M >
static Matcher<T> testing::internal::MatcherCastImpl< T, M >::CastImpl ( const M value,
BooleanConstant< false >   
)
inlinestaticprivate

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

References value.

538  {
539  // M can't be implicitly converted to Matcher<T>, so M isn't a polymorphic
540  // matcher. It must be a value then. Use direct initialization to create
541  // a matcher.
542  return Matcher<T>(ImplicitCast_<T>(value));
543  }
static const char *const value
Definition: Conv.cpp:50
template<typename T , typename M >
static Matcher<T> testing::internal::MatcherCastImpl< T, M >::CastImpl ( const M value,
BooleanConstant< false >   
)
inlinestaticprivate

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

References value.

538  {
539  // M can't be implicitly converted to Matcher<T>, so M isn't a polymorphic
540  // matcher. It must be a value then. Use direct initialization to create
541  // a matcher.
542  return Matcher<T>(ImplicitCast_<T>(value));
543  }
static const char *const value
Definition: Conv.cpp:50
template<typename T , typename M >
static Matcher<T> testing::internal::MatcherCastImpl< T, M >::CastImpl ( const M value,
BooleanConstant< false >   
)
inlinestaticprivate

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

References value.

538  {
539  // M can't be implicitly converted to Matcher<T>, so M isn't a polymorphic
540  // matcher. It must be a value then. Use direct initialization to create
541  // a matcher.
542  return Matcher<T>(ImplicitCast_<T>(value));
543  }
static const char *const value
Definition: Conv.cpp:50
template<typename T , typename M >
static Matcher<T> testing::internal::MatcherCastImpl< T, M >::CastImpl ( const M polymorphic_matcher_or_value,
BooleanConstant< true >   
)
inlinestaticprivate

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

546  {
547  // M is implicitly convertible to Matcher<T>, which means that either
548  // M is a polymorhpic matcher or Matcher<T> has an implicit constructor
549  // from M. In both cases using the implicit conversion will produce a
550  // matcher.
551  //
552  // Even if T has an implicit constructor from M, it won't be called because
553  // creating Matcher<T> would require a chain of two user-defined conversions
554  // (first to create T from M and then to create Matcher<T> from T).
555  return polymorphic_matcher_or_value;
556  }
template<typename T , typename M >
static Matcher<T> testing::internal::MatcherCastImpl< T, M >::CastImpl ( const M polymorphic_matcher_or_value,
BooleanConstant< true >   
)
inlinestaticprivate

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

546  {
547  // M is implicitly convertible to Matcher<T>, which means that either
548  // M is a polymorhpic matcher or Matcher<T> has an implicit constructor
549  // from M. In both cases using the implicit conversion will produce a
550  // matcher.
551  //
552  // Even if T has an implicit constructor from M, it won't be called because
553  // creating Matcher<T> would require a chain of two user-defined conversions
554  // (first to create T from M and then to create Matcher<T> from T).
555  return polymorphic_matcher_or_value;
556  }
template<typename T , typename M >
static Matcher<T> testing::internal::MatcherCastImpl< T, M >::CastImpl ( const M polymorphic_matcher_or_value,
BooleanConstant< true >   
)
inlinestaticprivate

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

546  {
547  // M is implicitly convertible to Matcher<T>, which means that either
548  // M is a polymorhpic matcher or Matcher<T> has an implicit constructor
549  // from M. In both cases using the implicit conversion will produce a
550  // matcher.
551  //
552  // Even if T has an implicit constructor from M, it won't be called because
553  // creating Matcher<T> would require a chain of two user-defined conversions
554  // (first to create T from M and then to create Matcher<T> from T).
555  return polymorphic_matcher_or_value;
556  }

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