Re: portable Unicode programming.
Eugene Gershnik wrote:
James Kanze wrote:
Carlos Moreno wrote:
I wonder: shouldn't one be able to implement a unicode string class
using the same class std::string with a special char type and its
special char_traits?
Yes, I do exactly that.
You must be a lot better than me. I tried, and gave up. The
amount of work it entailed just wasn't worth it.
In theory, or in practice? In practice, you can only
instantiate basic_string with char and wchar_t, using the
default arguments for the other template parameters. Some
implementations do allow more, but you can't count on it, and
what works with one implementation will fail with another.
Can you point out an implementation that wouldn't allow me to specialize
char_traits and instantiate basic_string with my own POD? The ones I am
familiar with (Dinkumware and STLPort) both have no problems in this area.
The implementations all allow you to do a lot of things that
don't work in practice, or aren't portable. If you're not doing
any I/O or formatting, you can probably even get a usable
std::basic_string< SomeType >. But what good is a text type
which you can neither read nor write? Nor, really, convert to
and from types which you can read and write.
--
James Kanze (Gabi Software) email: james.kanze@gmail.com
Conseils en informatique orient?e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S?mard, 78210 St.-Cyr-l'?cole, France, +33 (0)1 30 23 00 34
--
[ See http://www.gotw.ca/resources/clcm.htm for info about ]
[ comp.lang.c++.moderated. First time posters: Do this! ]