char_traits of user defined "char" type

M

multics.cn

Good day, c++ guys.

I have a question about char_traits of user defined "char" type. I
need a string type, which supports "long" as its "char" type, so I
defined a lstring like this:

typedef basic_string<long> lstring;

but I did not define template <> char_traits<long> {...};
It seems following code works:

lstring aLongString;
int aLongString.length();

I do not quite understand the roll of char_traits, can anyone help to
clearify?

Thanks.
 
W

wangmingshan

Good day, c++ guys.

I have a question about char_traits of user defined "char" type. I
need a string type, which supports "long" as its "char" type, so I
defined a lstring like this:

typedef basic_string<long> lstring;

but I did not define template <> char_traits<long> {...};
It seems following code works:

lstring aLongString;
int aLongString.length();

I do not quite understand the roll of char_traits, can anyone help to
clearify?

Thanks.

what? I am a new user fot this ,SO just try ,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,014
Latest member
BiancaFix3

Latest Threads

Top