From 7e7c15a4cc052e2f193f75bf7123a942a33aa0d8 Mon Sep 17 00:00:00 2001 From: Jens Maurer Date: Sun, 3 Mar 2002 10:03:00 +0000 Subject: [PATCH] add "long double" overloads of min/max for MSVC to avoid choosing the "long" overloads for floating-point numbers [SVN r13041] --- include/boost/config/suffix.hpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/boost/config/suffix.hpp b/include/boost/config/suffix.hpp index 5028e40a..7c0d7c24 100644 --- a/include/boost/config/suffix.hpp +++ b/include/boost/config/suffix.hpp @@ -205,12 +205,25 @@ namespace std { return __a < __b ? __b : __a; } # ifdef BOOST_MSVC + // Apparently, something in the Microsoft libraries requires the "long" + // overload, because it calls the min/max functions with arguments of + // slightly different type. (If this proves to be incorrect, this + // whole "BOOST_MSVC" section can be removed.) inline long min(long __a, long __b) { return __b < __a ? __b : __a; } inline long max(long __a, long __b) { return __a < __b ? __b : __a; } + // The "long double" overload is required, otherwise user code calling + // min/max for floating-point numbers will use the "long" overload. + // (SourceForge bug #495495) + inline long double min(long double __a, long double __b) { + return __b < __a ? __b : __a; + } + inline long double max(long double __a, long double __b) { + return __a < __b ? __b : __a; + } # endif }