aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvladlosev <vladlosev@861a406c-534a-0410-8894-cb66d6ee9925>2010-05-13 18:00:59 +0000
committervladlosev <vladlosev@861a406c-534a-0410-8894-cb66d6ee9925>2010-05-13 18:00:59 +0000
commit9af267d247f4af341e614a9c2cf2ee5272e796a2 (patch)
tree73111a6c8f4cd1d08e48e53f0d8383eaf6032779
parent7aec2f36baf6e3a423257914cab49cba8fd47abd (diff)
downloadgoogletest-9af267d247f4af341e614a9c2cf2ee5272e796a2.tar.gz
googletest-9af267d247f4af341e614a9c2cf2ee5272e796a2.tar.bz2
googletest-9af267d247f4af341e614a9c2cf2ee5272e796a2.zip
Replaces UniversalPrinter<T>::Print(x, os) with UniversalPrint(x, os) as appropriate (by Zhanyong Wan).
-rw-r--r--include/gtest/gtest-printers.h12
1 files 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 <typename T>
void PrintRawArrayTo(const T a[], size_t count, ::std::ostream* os) {
- UniversalPrinter<T>::Print(a[0], os);
+ UniversalPrint(a[0], os);
for (size_t i = 1; i != count; i++) {
*os << ", ";
- UniversalPrinter<T>::Print(a[i], os);
+ UniversalPrint(a[i], os);
}
}
@@ -515,6 +515,8 @@ void PrintTo(
template <typename T1, typename T2>
void PrintTo(const ::std::pair<T1, T2>& 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<T1>::Print(value.first, os);
*os << ", ";
UniversalPrinter<T2>::Print(value.second, os);
@@ -610,7 +612,7 @@ class UniversalPrinter<T&> {
*os << "@" << reinterpret_cast<const void*>(&value) << " ";
// Then prints the value itself.
- UniversalPrinter<T>::Print(value, os);
+ UniversalPrint(value, os);
}
#ifdef _MSC_VER
@@ -623,13 +625,13 @@ class UniversalPrinter<T&> {
// NUL-terminated string (but not the pointer) is printed.
template <typename T>
void UniversalTersePrint(const T& value, ::std::ostream* os) {
- UniversalPrinter<T>::Print(value, os);
+ UniversalPrint(value, os);
}
inline void UniversalTersePrint(const char* str, ::std::ostream* os) {
if (str == NULL) {
*os << "NULL";
} else {
- UniversalPrinter<string>::Print(string(str), os);
+ UniversalPrint(string(str), os);
}
}
inline void UniversalTersePrint(char* str, ::std::ostream* os) {