From 2d3543f81d6d4583332f8b60768ade18e0f96220 Mon Sep 17 00:00:00 2001 From: "zhanyong.wan" Date: Wed, 18 Sep 2013 17:49:56 +0000 Subject: avoids clash with the max() macro on Windows --- include/gtest/internal/gtest-internal.h | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'include/gtest/internal/gtest-internal.h') diff --git a/include/gtest/internal/gtest-internal.h b/include/gtest/internal/gtest-internal.h index 16047258..0dcc3a31 100644 --- a/include/gtest/internal/gtest-internal.h +++ b/include/gtest/internal/gtest-internal.h @@ -51,6 +51,7 @@ #endif #include +#include #include #include #include @@ -294,6 +295,9 @@ class FloatingPoint { return ReinterpretBits(kExponentBitMask); } + // Returns the maximum representable finite floating-point number. + static RawType Max(); + // Non-static methods // Returns the bits that represents this number. @@ -374,6 +378,13 @@ class FloatingPoint { FloatingPointUnion u_; }; +// We cannot use std::numeric_limits::max() as it clashes with the max() +// macro defined by . +template <> +inline float FloatingPoint::Max() { return FLT_MAX; } +template <> +inline double FloatingPoint::Max() { return DBL_MAX; } + // Typedefs the instances of the FloatingPoint template class that we // care to use. typedef FloatingPoint Float; -- cgit v1.2.3