From 9af267d247f4af341e614a9c2cf2ee5272e796a2 Mon Sep 17 00:00:00 2001 From: vladlosev Date: Thu, 13 May 2010 18:00:59 +0000 Subject: Replaces UniversalPrinter::Print(x, os) with UniversalPrint(x, os) as appropriate (by Zhanyong Wan). --- include/gtest/gtest-printers.h | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/include/gtest/gtest-printers.h b/include/gtest/gtest-printers.h index b15e366f..0466c9c2 100644 --- a/include/gtest/gtest-printers.h +++ b/include/gtest/gtest-printers.h @@ -395,10 +395,10 @@ inline void PrintTo(wchar_t* s, ::std::ostream* os) { // the curly braces. template void PrintRawArrayTo(const T a[], size_t count, ::std::ostream* os) { - UniversalPrinter::Print(a[0], os); + UniversalPrint(a[0], os); for (size_t i = 1; i != count; i++) { *os << ", "; - UniversalPrinter::Print(a[i], os); + UniversalPrint(a[i], os); } } @@ -515,6 +515,8 @@ void PrintTo( template void PrintTo(const ::std::pair& value, ::std::ostream* os) { *os << '('; + // We cannot use UniversalPrint(value.first, os) here, as T1 may be + // a reference type. The same for printing value.second. UniversalPrinter::Print(value.first, os); *os << ", "; UniversalPrinter::Print(value.second, os); @@ -610,7 +612,7 @@ class UniversalPrinter { *os << "@" << reinterpret_cast(&value) << " "; // Then prints the value itself. - UniversalPrinter::Print(value, os); + UniversalPrint(value, os); } #ifdef _MSC_VER @@ -623,13 +625,13 @@ class UniversalPrinter { // NUL-terminated string (but not the pointer) is printed. template void UniversalTersePrint(const T& value, ::std::ostream* os) { - UniversalPrinter::Print(value, os); + UniversalPrint(value, os); } inline void UniversalTersePrint(const char* str, ::std::ostream* os) { if (str == NULL) { *os << "NULL"; } else { - UniversalPrinter::Print(string(str), os); + UniversalPrint(string(str), os); } } inline void UniversalTersePrint(char* str, ::std::ostream* os) { -- cgit v1.2.3