Specializations of std::char_traits

Gabriel Dos Reis gdr@integrable-solutions.net
Thu Jul 17 11:00:00 GMT 2003


Pétur Runólfsson <peturr02@ru.is> writes:


[...]

|       static char_type* 
|       copy(char_type* __s1, const char_type* __s2, size_t __n)
|       {
|         memcpy(__s1, __s2, __n * sizeof(T));

         std::copy(__s2, __s2 + __n, __s1);


|         return __s1;
|       }
| 
|       static char_type* 
|       assign(char_type* __s, size_t __n, char_type __a)
|       {
|         char_type* __ret = __s;
|         while (__n--)
|           *__s++ = __a;
|         return __ret;

          std::fill_n(__s, __n, __a);

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

-- Gaby



More information about the Libstdc++ mailing list