From 4ad6f1bd4b64b9f88a6c67cf8702fc5b369a1d1f Mon Sep 17 00:00:00 2001 From: Antony Polukhin Date: Sat, 22 Dec 2012 18:42:04 +0000 Subject: [PATCH] FIx bug in conversion of some std::array implementations (refs #7799) [SVN r82172] --- include/boost/lexical_cast.hpp | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/include/boost/lexical_cast.hpp b/include/boost/lexical_cast.hpp index 1fd0b95..62dca33 100644 --- a/include/boost/lexical_cast.hpp +++ b/include/boost/lexical_cast.hpp @@ -1771,7 +1771,10 @@ namespace boost { #ifndef BOOST_NO_CXX11_HDR_ARRAY template bool operator<<(std::array const& input) BOOST_NOEXCEPT - { return shl_char_array_limited(input.begin(), N); } + { + if (input.size()) return shl_char_array_limited(&input[0], N); + else return true; + } template bool operator<<(std::array const& input) BOOST_NOEXCEPT @@ -1783,7 +1786,10 @@ namespace boost { template bool operator<<(std::array const& input) BOOST_NOEXCEPT - { return shl_char_array_limited(input.begin(), N); } + { + if (input.size()) return shl_char_array_limited(&input[0], N); + else return true; + } template bool operator<<(std::array const& input) BOOST_NOEXCEPT @@ -1984,8 +1990,8 @@ namespace boost { return false; } - memcpy(output.begin(), start, size * sizeof(CharT)); - *(output.begin() + size) = Traits::to_char_type(0); + memcpy(&output[0], start, size * sizeof(CharT)); + output[size] = Traits::to_char_type(0); return true; }