Specializations of std::char_traits

Matt Austern austern@apple.com
Wed Jul 16 17:40:00 GMT 2003


On Wednesday, July 16, 2003, at 8:57AM, B. Kosnik wrote:

>
>> (Users can't specialize std::char_traits for fundamental types.)
>
> For this reason, I'm more inclined to provide link-time definitions for
> unsigned char/signed char/unsigned short/short, where int_type is 
> pretty
> clear. I think this would be a good idea. These would not be in-line 
> but
> I think that would be ok. What do you think about this solution?

I think that would be a pretty clean solution.  It's not quite what I 
was
imagining, though: my suggestion was that we provide fully generic
versions, and that we just punt in int_type and the like.  That is, we'd
have a char_traits that's just barely enough so that users can write
std::basic_string<int> (or unsigned short, or long long, or whatever)
and that still can't be used for I/O.  My guess is that this will meet 
the
needs of the vast majority of users, that very few people really want
to instantiate std::basic_ostream<int>.

I can send in a patch if you think my description isn't clear enough,
but my feeling is that the two alternatives are both pretty simple.

			--matt



More information about the Libstdc++ mailing list