From 41a673db617e9afe03f8403cfb4be3f13618165e Mon Sep 17 00:00:00 2001 From: Antony Polukhin Date: Mon, 2 Apr 2012 15:33:46 +0000 Subject: [PATCH] Fixes #6717 (now also setting precision for float types conversion when using iostreams) [SVN r77716] --- include/boost/lexical_cast.hpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/include/boost/lexical_cast.hpp b/include/boost/lexical_cast.hpp index 438ee9c..cb7ae12 100644 --- a/include/boost/lexical_cast.hpp +++ b/include/boost/lexical_cast.hpp @@ -1254,7 +1254,7 @@ namespace boost { #if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_LOCALE) // If you have compilation error at this point, than your STL library - // unsupports such conversions. Try updating it. + // does not support such conversions. Try updating it. BOOST_STATIC_ASSERT((boost::is_same::value)); #endif bool const result = !(out_stream << input).fail(); @@ -1279,8 +1279,10 @@ namespace boost } template - bool shl_real_type(const T& val, SomeCharT*, SomeCharT*) + bool shl_real_type(const T& val, SomeCharT* begin, SomeCharT*& end) { + if (put_inf_nan(begin, end, val)) return true; + lcast_set_precision(out_stream, &val); return shl_input_streamable(val); }