$include_dir="/home/hyper-archives/boost-commit/include"; include("$include_dir/msg-header.inc") ?>
Subject: [Boost-commit] svn:boost r65279 - trunk/boost
From: Alexander.Nasonov_at_[hidden]
Date: 2010-09-04 20:02:26
Author: nasonov
Date: 2010-09-04 20:02:25 EDT (Sat, 04 Sep 2010)
New Revision: 65279
URL: http://svn.boost.org/trac/boost/changeset/65279
Log:
Fix an access to grouping[grouping.size()].
AFAIK, this is valid for const strings but STLport (when _STLP_DEBUG
is defined) doesn't like it.
The problem reported by Bogdan Dragu.
Text files modified: 
   trunk/boost/lexical_cast.hpp |     7 +++----                                 
   1 files changed, 3 insertions(+), 4 deletions(-)
Modified: trunk/boost/lexical_cast.hpp
==============================================================================
--- trunk/boost/lexical_cast.hpp	(original)
+++ trunk/boost/lexical_cast.hpp	2010-09-04 20:02:25 EDT (Sat, 04 Sep 2010)
@@ -527,11 +527,10 @@
             std::string::size_type const grouping_size = grouping.size();
             CharT thousands_sep = grouping_size ? np.thousands_sep() : 0;
             std::string::size_type group = 0; // current group number
-            char last_grp_size = grouping[0] <= 0 ? CHAR_MAX : grouping[0];
-            // a) Since grouping is const, grouping[grouping.size()] returns 0.
-            // b) It's safe to assume here and below that CHAR_MAX
-            //    is equivalent to unlimited grouping:
+            char last_grp_size =
+                grouping_size == 0 || grouping[0] <= 0 ? CHAR_MAX : grouping[0];
 #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
+            // Check that ulimited group is unreachable:
             BOOST_STATIC_ASSERT(std::numeric_limits<T>::digits10 < CHAR_MAX);
 #endif