Char_traits (part 2+)

Benjamin Kosnik bkoz@redhat.com
Fri Aug 16 11:32:00 GMT 2002


> | typedef unsigned short unicode_type;
> | typedef unsigned char unsigned_type;
> | 
> | then doing
> | 
> | template<> struct std::char_traits<unicode_type>
> | {
> | // do the work
> | }
> | 
> | etc. Isn't this legal?
> 
> No, it isn't.

Ouch. Is it implementation-defined, or illegal? If it's
implementation-defined (or undefined behavior), then can can libstdc++
"define" it to be ok for non-required types (all !(wchar_t || char))?

If not, then I don't see any clear way out of this mess.

> No.  A user-defined type is either a class-type or an enumeration.
> A typedef does not introduce a new type, it just introduces a synonymous
> for a type.

Ok, thanks.



More information about the Libstdc++ mailing list