Index: libcxx/include/locale =================================================================== --- libcxx/include/locale +++ libcxx/include/locale @@ -380,25 +380,45 @@ struct __num_get : protected __num_get_base { - static string __stage2_int_prep(ios_base& __iob, _CharT* __atoms, _CharT& __thousands_sep); + static string __stage2_int_prep(ios_base& __iob, _CharT& __thousands_sep); static string __stage2_float_prep(ios_base& __iob, _CharT* __atoms, _CharT& __decimal_point, _CharT& __thousands_sep); + const _CharT* __do_widen(ios_base& __iob, _CharT* __atoms) const + { + return __do_widen_p(__iob, __atoms); + } + + static int __stage2_int_loop(_CharT __ct, int __base, char* __a, char*& __a_end, unsigned& __dc, _CharT __thousands_sep, const string& __grouping, - unsigned* __g, unsigned*& __g_end, _CharT* __atoms); + unsigned* __g, unsigned*& __g_end, const _CharT* __atoms); static int __stage2_float_loop(_CharT __ct, bool& __in_units, char& __exp, char* __a, char*& __a_end, _CharT __decimal_point, _CharT __thousands_sep, const string& __grouping, unsigned* __g, unsigned*& __g_end, unsigned& __dc, _CharT* __atoms); +private: + template + const T* __do_widen_p(ios_base& __iob, T* __atoms) const + { + locale __loc = __iob.getloc(); + use_facet >(__loc).widen(__src, __src + 26, __atoms); + return __atoms; + } + + const char* __do_widen_p(ios_base& __iob, char* __atoms) const + { + (void)__iob; + (void)__atoms; + return __src; + } }; template string -__num_get<_CharT>::__stage2_int_prep(ios_base& __iob, _CharT* __atoms, _CharT& __thousands_sep) +__num_get<_CharT>::__stage2_int_prep(ios_base& __iob, _CharT& __thousands_sep) { locale __loc = __iob.getloc(); - use_facet >(__loc).widen(__src, __src + 26, __atoms); const numpunct<_CharT>& __np = use_facet >(__loc); __thousands_sep = __np.thousands_sep(); return __np.grouping(); @@ -421,7 +441,7 @@ int __num_get<_CharT>::__stage2_int_loop(_CharT __ct, int __base, char* __a, char*& __a_end, unsigned& __dc, _CharT __thousands_sep, const string& __grouping, - unsigned* __g, unsigned*& __g_end, _CharT* __atoms) + unsigned* __g, unsigned*& __g_end, const _CharT* __atoms) { if (__a_end == __a && (__ct == __atoms[24] || __ct == __atoms[25])) { @@ -854,9 +874,10 @@ // Stage 1 int __base = this->__get_base(__iob); // Stage 2 - char_type __atoms[26]; + char_type __atoms1[26]; char_type __thousands_sep; - string __grouping = this->__stage2_int_prep(__iob, __atoms, __thousands_sep); + const char_type *__atoms = this->__do_widen(__iob, __atoms1); + string __grouping = this->__stage2_int_prep(__iob, __thousands_sep); string __buf; __buf.resize(__buf.capacity()); char* __a = &__buf[0]; @@ -904,9 +925,10 @@ // Stage 1 int __base = this->__get_base(__iob); // Stage 2 - char_type __atoms[26]; + char_type __atoms1[26]; char_type __thousands_sep; - string __grouping = this->__stage2_int_prep(__iob, __atoms, __thousands_sep); + const char_type *__atoms = this->__do_widen(__iob, __atoms1); + string __grouping = this->__stage2_int_prep(__iob, __thousands_sep); string __buf; __buf.resize(__buf.capacity()); char* __a = &__buf[0];