• Advertisement

Archived

This topic is now archived and is closed to further replies.

C++: Best String Class

This topic is 5063 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I''ve heard many different opinions on this, from using APString, to character arrays, to many other various strings, but which is the best for C++? It seems the compiler is set up for many different ways a string can be approached, but what has worked for you guys?

Share this post


Link to post
Share on other sites
Advertisement
std::string in the <string> header. There's no reason to use anything else, as this is provided in all compliant C++ compilers.

[edited by - cgoat on April 16, 2004 12:02:59 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by Zipster
Actually, std::wstring would be the best because you can write your software to support multiple languages
I typedef my string:

#ifdef UNICODE
typedef string std::wstring
#else
typedef string std::string

Share this post


Link to post
Share on other sites
I typedef my string better:

namespace psykr {
#ifdef UNICODE
typedef tstring ::std::wstring;
#else
typedef tstring ::std::string;
#endif //!UNICODE
};


edit: Forgot to add the point of the post. Use a name that won't conflict, and including it within my own namespace makes such errors harder to do.

[edited by - psykr on April 16, 2004 4:52:41 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by DannyB
using APString

Nobody outside of AP courses uses APString.


Thanks Salsa!Colin Jeanne | Invader''s Realm
"I forgot I had the Scroll Lock key until a few weeks ago when some asshole program used it. It even used it right" - Conner McCloud

Share this post


Link to post
Share on other sites
quote:
Original post by Invader X
quote:
Original post by DannyB
using APString

Nobody outside of AP courses uses APString.



And if you try, I will go over there personally to beat you. Though believe me, I won''t be the only one.

Share this post


Link to post
Share on other sites

  • Advertisement