From 91b77e7373d456d732f7d2efbc2cb6da5b6ab7bb Mon Sep 17 00:00:00 2001 From: Antony Polukhin Date: Mon, 16 Dec 2013 19:05:43 +0400 Subject: [PATCH] Do forward input streamable parameter during lexical input streaming. --- include/boost/lexical_cast.hpp | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/include/boost/lexical_cast.hpp b/include/boost/lexical_cast.hpp index 3986f00..dfd833d 100644 --- a/include/boost/lexical_cast.hpp +++ b/include/boost/lexical_cast.hpp @@ -1394,7 +1394,14 @@ namespace boost { } template +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + bool shl_input_streamable(InputStreamable&& input) { + typedef InputStreamable&& forward_type; +#else bool shl_input_streamable(InputStreamable& input) { + typedef InputStreamable& forward_type; +#endif // BOOST_NO_CXX11_RVALUE_REFERENCES + #if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_LOCALE) // If you have compilation error at this point, than your STL library // does not support such conversions. Try updating it. @@ -1405,7 +1412,7 @@ namespace boost { out_stream.exceptions(std::ios::badbit); try { #endif - bool const result = !(out_stream << input).fail(); + bool const result = !(out_stream << static_cast(input)).fail(); const buffer_t* const p = static_cast( static_cast*>(out_stream.rdbuf()) );