sorry for the n'th thread on this, i've read some threads on it, but i was look for a suggestion about the best way to go writing portable code.
I was looking for the best way to align std::string to wxString.
I've started to work with wxWidgets 2.8 under windows. I've soon noticed that wxString and std::string, even if are 2 different objects, are both usable in the same way, almost for my development point of view.
So i've used some old cpp modules i've written with std::string, and also std::string somewhere, and wxString in other places, in a mixed fashon.
Then i've installed wxwidgets 2.8 on linux debian, and i've soon discovered that the default installation of wxgtk is unicode.
wxString so here is unicode based, and obviously the same code don't compile anymore. As mentioned in other thread, in this case std::wstring should be intercangheable.
For now i've solved using this syntax.
Code: Select all
wxString(myStdString.c_str(), wxConvUTF8));
I would mantain some old modules using the std templates, just to be compiled without wxWidgets library when i need.
Is this practice an acceptable way to go ? Is this conversion passage heavy in some way even if the string is already ascii based ?
Thanks
angelo