From 795b7e18099e11c35bb693503d74b3d30576cdda Mon Sep 17 00:00:00 2001 From: Gennaro Prota Date: Sat, 5 Aug 2006 22:45:53 +0000 Subject: [PATCH] there seems to be no reasonable form which avoids warnings with all compilers; so let's use a clear style and filter explicitly the VC warning [SVN r34820] --- include/boost/lexical_cast.hpp | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/include/boost/lexical_cast.hpp b/include/boost/lexical_cast.hpp index bb45719..38ec6af 100644 --- a/include/boost/lexical_cast.hpp +++ b/include/boost/lexical_cast.hpp @@ -136,20 +136,21 @@ namespace boost { stream.unsetf(std::ios::skipws); - // The odd style used below is to avoid spurious compiler - // warnings about using is_specialized as a (constant) - // conditional expression +#if (defined _MSC_VER) +# pragma warning( push ) + // conditional expression is constant +# pragma warning( disable : 4127 ) typedef std::numeric_limits t; typedef std::numeric_limits s; - bool setup_target = t::is_specialized; - if (setup_target) - stream.precision(t::digits10 + 1); - else - ((s::is_specialized) && - stream.precision(s::digits10 + 1)); + if(t::is_specialized) + stream.precision(1 + t::digits10); + else if(s::is_specialized) + stream.precision(1 + s::digits10); +# pragma warning( pop ) +#endif } ~lexical_stream()