user-defined types and basic_string
Martin Sebor
sebor@roguewave.com
Fri Aug 23 12:08:00 GMT 2002
Matte Austere wrote:
...
> But the biggest problem, I think, is that specializing char_traits is
> just a
> tiny piece of the work that users need to do to write a new character
> type. Seems to me that anyone who's capable of writing a specialization
> std::ctype<my_char> is more than capable of writing
> std::char_traits<my_char>,
> and it'll be a specialization that's right, not just a generic version
> that's almost right.
>
> I vote for leaving the generic std::char_traits undefined.
You're probably right if one needs the character type to work with
iostreams. But if all one wants is a basic_string<int> or any other
specialization on a native type besides char and wchar_t, I'd say
the almost right primary template is perfectly adequate.
Martin
More information about the Libstdc++
mailing list