lmi
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi] Safe to substitute std::string for wxString?


From: Greg Chicares
Subject: [lmi] Safe to substitute std::string for wxString?
Date: Thu, 30 Mar 2006 03:08:56 +0000
User-agent: Mozilla Thunderbird 1.0.2 (Windows/20050317)

I find this dubious idiom in some of my old code:

  std::string data = [whatever];
  wxRadioBox& control = [whatever];

  // Convert between wxString and std::string via char const* .
  if(-1 < control.FindString(data.c_str()))
    control.SetStringSelection(data.c_str());

In the wx-2.2.x era, that seemed to make sense. But now this

  if(-1 < control.FindString(data))
    control.SetStringSelection(data);

seems clearer, and if it's actually more efficient [not measured]
then that may actually make a difference because this code is
called repeatedly in a wxEVT_UPDATE_UI handler.

However, I guess that change would force us to use '--enable-stl'
(or at least the weaker use-std-string option) always. Is there a
way to avoid forcing that requirement? Has wx evolved conversion
operators that make this work automagically? Will it eventually
evolve so that wxString will vanish and be replaced by std::string
throughout the library?




reply via email to

[Prev in Thread] Current Thread [Next in Thread]