forked from boostorg/conversion
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. [SVN r65279]
This commit is contained in:
@ -527,11 +527,10 @@ namespace boost
|
|||||||
std::string::size_type const grouping_size = grouping.size();
|
std::string::size_type const grouping_size = grouping.size();
|
||||||
CharT thousands_sep = grouping_size ? np.thousands_sep() : 0;
|
CharT thousands_sep = grouping_size ? np.thousands_sep() : 0;
|
||||||
std::string::size_type group = 0; // current group number
|
std::string::size_type group = 0; // current group number
|
||||||
char last_grp_size = grouping[0] <= 0 ? CHAR_MAX : grouping[0];
|
char last_grp_size =
|
||||||
// a) Since grouping is const, grouping[grouping.size()] returns 0.
|
grouping_size == 0 || grouping[0] <= 0 ? CHAR_MAX : grouping[0];
|
||||||
// b) It's safe to assume here and below that CHAR_MAX
|
|
||||||
// is equivalent to unlimited grouping:
|
|
||||||
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
||||||
|
// Check that ulimited group is unreachable:
|
||||||
BOOST_STATIC_ASSERT(std::numeric_limits<T>::digits10 < CHAR_MAX);
|
BOOST_STATIC_ASSERT(std::numeric_limits<T>::digits10 < CHAR_MAX);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user