This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Making strings of arbitrary character types


Hi,

But with GCC 3.4.2, basic_string<unsigned char> works out of the box.

Does 3.4.2 provide a specialization for this type (and possibly others)?
If so, is it intentional (ie. can I expect it in future versions)?  Or
should I specialize char_traits for portability?

Hey, this is Free Software, no mysteries! ;)

Have a look to include/bits/char_traits.h, there are plenty of interesting comments
and info. You will learn that a "generalization" of char_traits is now provided, which
often will work out of the box for many POD types besides char and wchar_t.
However, you will also learn that some typedef and eof() are likely to be wrong,
in general (are Ok for unsigned char, by the way, and other "simple" cases)


Indeed, this is an *intentional* improvement, and you can expect it to be present at
least in the whole 3.4.x series and the forthcoming 4.0.x series. You are also right,
however, that the fully portable solution involves providing your own char_traits
(probably, you can master that by studying the above file!)


Thanks,
Paolo.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]