Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

basic_string specialization problem

6 views
Skip to first unread message

Gilbert Chang

unread,
Oct 17, 2003, 9:03:37 PM10/17/03
to
The standard C++ library does not seem to pre-instantiate the basic_string
specialization with unsigned short. I couldn't manually get g++ to
instantiate it either. The problem can be reproduced with the following
code. This is with g++ v3.2. Any idea? Thanks.

#include <string>

typedef unsigned short Chr;

typedef std::basic_string<Chr, std::char_traits<Chr>, std::allocator<Chr> >
ustring;

int main(void) {

unsigned short c = 0x1234;

ustring s(&c);

ustring s2 = s;

}


Erik Max Francis

unread,
Oct 17, 2003, 11:09:25 PM10/17/03
to
Gilbert Chang wrote:

> The standard C++ library does not seem to pre-instantiate the
> basic_string
> specialization with unsigned short. I couldn't manually get g++ to
> instantiate it either. The problem can be reproduced with the
> following
> code. This is with g++ v3.2. Any idea? Thanks.

Why do you think it should? The reason traits and allocators exist is
precisely so that you can define those things yourself. If you want
something other than std::basic_string<char> or
std::basic_string<wchar_t>, you're going to have to define the traits
yourself.

--
Erik Max Francis && m...@alcyone.com && http://www.alcyone.com/max/
__ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/ \ Don't want you to leave / And I don't want to leave you
\__/ Chante Moore

0 new messages