, UT ostream, . . , gmock .
- PrintTo, , , PrintTo, , . gmock 1.7 C++14 GCC.
template <class, class = void>
struct IsDefined : std::false_type
{};
template <class T>
struct IsDefined<T, std::enable_if_t<std::is_object<T>::value
&& not std::is_pointer<T>::value
&& (sizeof(T) > 0)>>
: std::true_type
{};
template <
typename T,
typename = std::enable_if_t<
not IsDefined<T>::value and
not std::is_pointer<T>::value and
std::is_object<T>::value>>
std::ostream& operator<<(std::ostream& os, const T& ref)
{
os << "Forward declared ref: " << static_cast<const void*>(&ref);
return os;
}