Specializations of std::char_traits
Pétur Runólfsson
peturr02@ru.is
Thu Jul 17 11:57:00 GMT 2003
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
More information about the Libstdc++
mailing list