From 95b0ea2cf5046465f448f01efa7c4b764a62a4bb Mon Sep 17 00:00:00 2001 From: Krystian Kuzniarek Date: Sat, 7 Mar 2020 15:48:20 +0100 Subject: specialize UniversalPrinter<> for std::optional --- googletest/include/gtest/gtest-printers.h | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'googletest/include/gtest/gtest-printers.h') diff --git a/googletest/include/gtest/gtest-printers.h b/googletest/include/gtest/gtest-printers.h index 39c72c43..4260e4f7 100644 --- a/googletest/include/gtest/gtest-printers.h +++ b/googletest/include/gtest/gtest-printers.h @@ -113,7 +113,6 @@ #if GTEST_HAS_ABSL #include "absl/strings/string_view.h" -#include "absl/types/optional.h" #endif // GTEST_HAS_ABSL namespace testing { @@ -680,14 +679,14 @@ class UniversalPrinter { GTEST_DISABLE_MSC_WARNINGS_POP_() }; -#if GTEST_HAS_ABSL +#if GTEST_INTERNAL_HAS_OPTIONAL -// Printer for absl::optional +// Printer for std::optional / absl::optional template -class UniversalPrinter<::absl::optional> { +class UniversalPrinter> { public: - static void Print(const ::absl::optional& value, ::std::ostream* os) { + static void Print(const Optional& value, ::std::ostream* os) { *os << '('; if (!value) { *os << "nullopt"; @@ -698,7 +697,7 @@ class UniversalPrinter<::absl::optional> { } }; -#endif // GTEST_HAS_ABSL +#endif // GTEST_INTERNAL_HAS_OPTIONAL #if GTEST_INTERNAL_HAS_VARIANT -- cgit v1.2.1