This is the mail archive of the
libstdc++@gcc.gnu.org
mailing list for the libstdc++ project.
Re: Specializations of std::char_traits
- From: Gabriel Dos Reis <gdr at integrable-solutions dot net>
- To: Pétur Runólfsson <peturr02 at ru dot is>
- Cc: "Benjamin Kosnik" <bkoz at redhat dot com>, <austern at apple dot com>, <ncm-nospam at cantrip dot org>, <libstdc++ at gcc dot gnu dot org>
- Date: 17 Jul 2003 12:55:33 +0200
- Subject: Re: Specializations of std::char_traits
- Organization: Integrable Solutions
- References: <07D05A69A3D0C14FAEA60C3ACE8E5564028F559A@nike.hir.is>
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