• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Xcode's STL problem, works fine in MW
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Xcode's STL problem, works fine in MW


  • Subject: Re: Xcode's STL problem, works fine in MW
  • From: Marshall Clow <email@hidden>
  • Date: Sat, 19 Feb 2005 14:20:17 -0800

Hi,

I'm moving a project from MW to Xcode and that project uses STL for unicode strings. It builds fine in MW but there seems to be problem with STL since it does not seem to instantiate the following methods (I'm getting a link error):

std::char_traits<unsigned short>::copy(unsigned short*, unsigned short const*, unsigned long)
std::char_traits<unsigned short>::move(unsigned short*, unsigned short const*, unsigned long)
std::char_traits<unsigned short>::length(unsigned short const*)


Would it mean that I have to define them on my own?

Yes.

This is an interesting problem, full of twists and turns.
Consider:
1) Both compilers define and implement std::char_traits < char > and std::char_traits < wchar_t >


2) In XCode wchar_t ==> 32 bits, while in CodeWarrior wchar_t ==> 16 bits

But wait!
3) Codewarrior has a char_traits implementation which is entirely template-based,
so it can be instantiated for any integral type.


4) GCC does not have a completely template-based implementation of char_traits. In fact, I found a posting on a GCC mailing list (link lost) by one of the gcc maintainers that stated that it was, in fact, impossible to make a compliant, fully templated implementation of std::char_traits.

So, if you are doing something like:
typedef std::basic_string < unsigned short> unistr ;
and you want it to work on gcc/xcode, you have to define those missing functions.


Fortunately, they are pretty simple to code up.

P.S. There are lots of reasons not to use basic_string to hold Unicode strings, all of which boil down to the fact that "one entry in the string != one Unicode character". This causes problems when searching, inserting, deleting, and comparing these strings.
--
-- Marshall


Marshall Clow     Idio Software   <mailto:email@hidden>

It is by caffeine alone I set my mind in motion.
It is by the beans of Java that thoughts acquire speed,
the hands acquire shaking, the shaking becomes a warning.
It is by caffeine alone I set my mind in motion.
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden


  • Follow-Ups:
    • Re: Xcode's STL problem, works fine in MW
      • From: Chris Espinosa <email@hidden>
  • Prev by Date: Something is not getting cleaned...
  • Next by Date: Re: calling isnan
  • Previous by thread: Re: Xcode's STL problem, works fine in MW
  • Next by thread: Re: Xcode's STL problem, works fine in MW
  • Index(es):
    • Date
    • Thread