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: Specializations of std::char_traits


Gabriel Dos Reis wrote:
>|         memcpy(__s1, __s2, __n * sizeof(T));
>
>         std::copy(__s2, __s2 + __n, __s1);
[...]
>|       {
>|         char_type* __ret = __s;
>|         while (__n--)
>|           *__s++ = __a;
>|         return __ret;
>
>          std::fill_n(__s, __n, __a);

Sure.

>As of int_type, I was contemplating the idea of using the promoted-to
>type of char_type.

I don't think it matters if int_type or the functions using it are
provided or not - they are only used by iostreams, and iostreams
won't work unless some facets are provided (ctype, numpunct for
numeric formatting, codecvt for file I/O).

It would make sense to make char_traits<wchar_t>::int_type be the
same type as wint_t on all platforms. This can easily be done with
a separate check for wint_t and a fallback definition, similar to
mbstate_t.

Petur


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