This is the mail archive of the libstdc++@gcc.gnu.org mailing list for the libstdc++ project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [RFC] PR 6015: number formatting is not mt-safe




It would be like this.

  template<typename _Tv>
    int
    __convert_from_v(char* __out, const int __size, const char* __fmt,
		     _Tv __v, const __c_locale& __cloc, int __prec = -1)
    {
      int __ret;
      __c_locale __old = __uselocale(__cloc);
      if (__prec >= 0)
        __ret = snprintf(__out, __size, __fmt, __prec, __v);
      else
        __ret = snprintf(__out, __size, __fmt, __v);
      __uselocale(__old);

      return __ret;
    }

There are more hooks for this kind of functionality in the config/locale/gnu.

-benjamin


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]