Char_traits (part 2+)

Gabriel Dos Reis gdr@integrable-solutions.net
Fri Aug 16 11:13:00 GMT 2002


Benjamin Kosnik <bkoz@redhat.com> writes:

[...]

| I guess I was thinking more of something like
| 
| 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.

| Aren't these user-defined types, and thus allowed
| to do the specialization of std::char_traits?

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.

-- Gaby



More information about the Libstdc++ mailing list