| 8465 | // wants). |
| 8466 | template <typename T> |
| 8467 | void PrintTo(const T& value, ::std::ostream* os) { |
| 8468 | // DefaultPrintTo() is overloaded. The type of its first argument |
| 8469 | // determines which version will be picked. |
| 8470 | // |
| 8471 | // Note that we check for container types here, prior to we check |
| 8472 | // for protocol message types in our operator<<. The rationale is: |
| 8473 | // |
| 8474 | // For protocol messages, we want to give people a chance to |
| 8475 | // override Google Mock's format by defining a PrintTo() or |
| 8476 | // operator<<. For STL containers, other formats can be |
| 8477 | // incompatible with Google Mock's format for the container |
| 8478 | // elements; therefore we check for container types here to ensure |
| 8479 | // that our format is used. |
| 8480 | // |
| 8481 | // Note that MSVC and clang-cl do allow an implicit conversion from |
| 8482 | // pointer-to-function to pointer-to-object, but clang-cl warns on it. |
| 8483 | // So don't use ImplicitlyConvertible if it can be helped since it will |
| 8484 | // cause this warning, and use a separate overload of DefaultPrintTo for |
| 8485 | // function pointers so that the `*os << p` in the object pointer overload |
| 8486 | // doesn't cause that warning either. |
| 8487 | DefaultPrintTo( |
| 8488 | WrapPrinterType < |
| 8489 | (sizeof(IsContainerTest<T>(0)) == sizeof(IsContainer)) && |
| 8490 | !IsRecursiveContainer<T>::value |
| 8491 | ? kPrintContainer |
| 8492 | : !std::is_pointer<T>::value |
| 8493 | ? kPrintOther |
| 8494 | : std::is_function<typename std::remove_pointer<T>::type>::value |
| 8495 | ? kPrintFunctionPointer |
| 8496 | : kPrintPointer > (), |
| 8497 | value, os); |
| 8498 | } |
| 8499 | |
| 8500 | // The following list of PrintTo() overloads tells |
| 8501 | // UniversalPrinter<T>::Print() how to print standard types (built-in |
no test coverage detected