char_traits of user defined "char" type



 DEVELOP > c-Plus-Plus > char_traits of user defined "char" type

LINK TO THIS PAGE  


rating :  0   |  0


  Page 1 of 1

1

 
Topic: DEVELOP > c-Plus-Plus
User: "multics.cn"
Date: 28 Dec 2007 01:24:44 AM
Object: char_traits of user defined "char" type
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.
.

User: ""

Title: Re: char_traits of user defined "char" type 28 Dec 2007 09:50:37 AM
On 12=D4=C228=C8=D5, =CF=C2=CE=E73=CA=B124=B7=D6, "multics.cn" <multics...@g=
mail.com> wrote:

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 ,
.


  Page 1 of 1

1

 


Related Articles
char_traits::compare
/usr/bin/ld: ../../dist/lib/libjsdombase_s.a(BlockGrouper.o)(.text+0x98): unresolvable relocation against symbol `std::basic_ostream >& std::endl >(std::basic_ostream
Linking error LNK2001 - "__declspec(dllimport) private: void __thiscall std::basic_string,class std::allocator >::_Tidy(unsigned short)" (__imp_?_Tidy@?$basic_string@DU?$char_
Greta and basic_string
templates - container traits
Template traits
Problem with C++ traits under OSX
policy based design, and traits
Problem with std::basic_istream<_Elem,_Traits> &std::getline()
How Best to Incorporate Traits and a Policies
One type traits class (or something like that) to get the return type of a pointer to function
What are those _Traits for?
iterator_traits
Refactoring Traits and Policies (in Containers)
help on std::iterator_traits?
 

NEWER

pg.1232     pg.940     pg.716     pg.544     pg.412     pg.311     pg.234     pg.175     pg.130     pg.96     pg.70     pg.50     pg.35     pg.24     pg.16     pg.10     pg.6     pg.3     pg.1

OLDER