diff options
| author | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2013-09-18 17:49:56 +0000 |
|---|---|---|
| committer | zhanyong.wan <zhanyong.wan@861a406c-534a-0410-8894-cb66d6ee9925> | 2013-09-18 17:49:56 +0000 |
| commit | be1b3b66822cc3929f3da700973cef88bf45849a (patch) | |
| tree | 87b8d6bdc73d7b0105e7837aab4d77402437ebf2 /include | |
| parent | 1cb04aa3e99c736bbd1eb90ebda3d6117355aacc (diff) | |
| download | gtest-be1b3b66822cc3929f3da700973cef88bf45849a.tar.gz gtest-be1b3b66822cc3929f3da700973cef88bf45849a.tar.bz2 gtest-be1b3b66822cc3929f3da700973cef88bf45849a.tar.xz | |
avoids clash with the max() macro on Windows
git-svn-id: http://googletest.googlecode.com/svn/trunk@663 861a406c-534a-0410-8894-cb66d6ee9925
Diffstat (limited to 'include')
| -rw-r--r-- | include/gtest/internal/gtest-internal.h | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/include/gtest/internal/gtest-internal.h b/include/gtest/internal/gtest-internal.h index 1604725..0dcc3a3 100644 --- a/include/gtest/internal/gtest-internal.h +++ b/include/gtest/internal/gtest-internal.h @@ -51,6 +51,7 @@ #endif #include <ctype.h> +#include <float.h> #include <string.h> #include <iomanip> #include <limits> @@ -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<T>::max() as it clashes with the max() +// macro defined by <windows.h>. +template <> +inline float FloatingPoint<float>::Max() { return FLT_MAX; } +template <> +inline double FloatingPoint<double>::Max() { return DBL_MAX; } + // Typedefs the instances of the FloatingPoint template class that we // care to use. typedef FloatingPoint<float> Float; |
