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

3.0, wxString, and STL algorithms

3 views
Skip to first unread message

Gerald Brandt

unread,
Jun 6, 2009, 11:17:43 AM6/6/09
to
Hi,

Since wxString (in wxWidgets 3.0) is based on std::basic_string, can I use stl algorithms on wxString?  For example, I'd like to use copy_backward() on a wxString.

Gerald

Vadim Zeitlin

unread,
Jun 6, 2009, 11:15:18 AM6/6/09
to
On Sat, 6 Jun 2009 10:17:43 -0500 (CDT) Gerald Brandt <g...@majentis.com> wrote:

GB> Since wxString (in wxWidgets 3.0) is based on std::basic_string,

It isn't. It does use std::basic_string internally (unless disabled) but
it doesn't inherit from it which is usually meant by "based on".

GB> can I use stl algorithms on wxString?

You should be able to as it provides the same interface as standard string
class. If anything is missing, let us know.

GB> For example, I'd like to use copy_backward() on a wxString.

You should be able to do it in both 2.9.0 and 2.8.x as well.

Regards,
VZ

--
TT-Solutions: wxWidgets consultancy and technical support
http://www.tt-solutions.com/

Gerald Brandt

unread,
Jun 6, 2009, 11:45:03 AM6/6/09
to
Thanks for the quick response.  I re-read the wxString info, and saw where I made my mistake.

I'm currently using a vector of wxChar for my data, but I can't seem to find any documentation on how wxChar handles Unicode characters, or even if it does Unicode.  I've been looking through the 3.0 docs at http://docs.wxwidgets.org/trunk.  I must be missing something.

I'm considerring moving to wxString simply because it simplifies some data management for me, even though the data I'm dealing with is not a string.

Gerald

----- "Vadim Zeitlin" <va...@wxwidgets.org> wrote:
> On Sat, 6 Jun 2009 10:17:43 -0500 (CDT) Gerald Brandt wrote: GB> Since wxString (in wxWidgets 3.0) is based on std::basic_string, It isn't. It does use std::basic_string internally (unless disabled) but it doesn't inherit from it which is usually meant by "based on". GB> can I use stl algorithms on wxString? You should be able to as it provides the same interface as standard string class. If anything is missing, let us know. GB> For example, I'd like to use copy_backward() on a wxString. You should be able to do it in both 2.9.0 and 2.8.x as well. Regards, VZ -- TT-Solutions: wxWidgets consultancy and technical support http://www.tt-solutions.com/
> _______________________________________________ wx-users mailing list wx-u...@lists.wxwidgets.org http://lists.wxwidgets.org/mailman/listinfo/wx-users

Vadim Zeitlin

unread,
Jun 6, 2009, 1:23:43 PM6/6/09
to
On Sat, 6 Jun 2009 10:45:03 -0500 (CDT) Gerald Brandt <g...@majentis.com> wrote:

GB> I'm currently using a vector of wxChar for my data, but I can't seem to
GB> find any documentation on how wxChar handles Unicode characters, or
GB> even if it does Unicode.

wxChar is just wchar_t. You may want to use wxUniChar which is 32 bit
everywhere unlike it.

GB> I'm considerring moving to wxString simply because it simplifies some
GB> data management for me, even though the data I'm dealing with is not a
GB> string.

wxString is strongly geared towards working with strings even though you
should be able to use it with any data so you should use std::string if you
really need an 8 bit data container.

0 new messages