Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r82172 - trunk/boost
From: antoshkka_at_[hidden]
Date: 2012-12-22 13:42:04


Author: apolukhin
Date: 2012-12-22 13:42:04 EST (Sat, 22 Dec 2012)
New Revision: 82172
URL: http://svn.boost.org/trac/boost/changeset/82172

Log:
FIx bug in conversion of some std::array implementations (refs #7799)
Text files modified:
   trunk/boost/lexical_cast.hpp | 14 ++++++++++----
   1 files changed, 10 insertions(+), 4 deletions(-)

Modified: trunk/boost/lexical_cast.hpp
==============================================================================
--- trunk/boost/lexical_cast.hpp (original)
+++ trunk/boost/lexical_cast.hpp 2012-12-22 13:42:04 EST (Sat, 22 Dec 2012)
@@ -1771,7 +1771,10 @@
 #ifndef BOOST_NO_CXX11_HDR_ARRAY
             template <std::size_t N>
             bool operator<<(std::array<CharT, N> 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 <std::size_t N>
             bool operator<<(std::array<unsigned char, N> const& input) BOOST_NOEXCEPT
@@ -1783,7 +1786,10 @@
 
             template <std::size_t N>
             bool operator<<(std::array<const CharT, N> 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 <std::size_t N>
             bool operator<<(std::array<const unsigned char, N> const& input) BOOST_NOEXCEPT
@@ -1984,8 +1990,8 @@
                     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;
             }
 


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk