From 19f316f768a20c45365e87e075b431c951def6d4 Mon Sep 17 00:00:00 2001 From: Antony Polukhin Date: Tue, 26 Jul 2011 18:51:39 +0000 Subject: [PATCH] Fixes #5732. * fixes compilation errors pgi compiler * fixes some bugs for MinGW compiler [SVN r73384] --- include/boost/lexical_cast.hpp | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/include/boost/lexical_cast.hpp b/include/boost/lexical_cast.hpp index 9e0a7af..5987908 100644 --- a/include/boost/lexical_cast.hpp +++ b/include/boost/lexical_cast.hpp @@ -47,6 +47,10 @@ #include #include +#ifdef __PGI +#include +#endif + #ifndef BOOST_NO_STD_LOCALE # include #else @@ -1134,7 +1138,7 @@ namespace boost finish = start + sprintf(out,"%.*lg", static_cast(boost::detail::lcast_get_precision()), val ); return finish > start; } - +#ifndef __MINGW32__ template bool shl_long_double(long double val,T* out) { using namespace std; @@ -1142,6 +1146,7 @@ namespace boost finish = start + sprintf(out,"%.*Lg", static_cast(boost::detail::lcast_get_precision()), val ); return finish > start; } +#endif #if (defined _MSC_VER) # pragma warning( pop ) @@ -1180,16 +1185,16 @@ namespace boost return finish > start; } +#ifndef __MINGW32__ bool shl_long_double(long double val,wchar_t* out) { using namespace std; if (put_inf_nan(start,finish,val)) return true; - finish = start + swprintf(out, -#ifndef __MINGW32__ - finish-start, -#endif - L"%.*Lg", static_cast(boost::detail::lcast_get_precision()), val ); + finish = start + swprintf(out,finish-start, + L"%.*Lg", static_cast(boost::detail::lcast_get_precision()), val ); return finish > start; } + #endif + #endif /************************************ OPERATORS << ( ... ) ********************************/ @@ -1242,7 +1247,13 @@ namespace boost #endif bool operator<<(float val) { return shl_float(val,start); } bool operator<<(double val) { return shl_double(val,start); } - bool operator<<(long double val) { return shl_long_double(val,start); } + bool operator<<(long double val) { +#ifndef __MINGW32__ + return shl_long_double(val,start); +#else + return shl_double(val,start); +#endif + } template bool operator<<(const InStreamable& input) { return shl_input_streamable(input); }