Re: Question on string
On Apr 3, 7:58 pm, Vladyslav Lazarenko <vlazare...@volanttrading.com>
wrote:
On Apr 3, 1:37 pm, peter koch <peter.koch.lar...@gmail.com> wrote:
On 3 Apr., 19:17, Odysseas Gabrielides
<greekso...@hotmail.com> wrote:
How can I use unsigned chars in a string object ?
The portable way is by specialising on unsigned char
typedef std::basic_string< unsigned char, std::char_traits<unsigned
int>, std::allocator<unsigned char> > ustring;
Unspecified behavior. It may not compile, and if it does, it is
likely to have different behavior on different machines. (I
seem to recall someone trying it with g++ and VC++ in the French
speaking newsgroup, and getting different behavior.)
The only way to do this portably is something like:
class MyUnsignedCharTraits { /* ... */ } ;
typedef std::basic_string< unsigned char, MyUnsignedCharTraits >
UCString ;
If you want IO, etc. as well, you'll also have to implement a
lot of locale.
--
James Kanze (GABI Software) email:james.kanze@gmail.com
Conseils en informatique orient=E9e objet/
Beratung in objektorientierter Datenverarbeitung
9 place S=E9mard, 78210 St.-Cyr-l'=C9cole, France, +33 (0)1 30 23 00 34