since char is convertible to wchar_t and vice versa (with a possibility for lost precision of course) I usually just do this:
string s("something");
wstring ws(s.begin(), s.end());
You can do the reverse with wstring to string and as long your wstring doesn't contain non-ASCII characters it should be okay.
--- On Wed, 6/18/08, Hansi wrote:
From: Hansi
Subject: [Boost-users] convert std::string to std::wstring
To: boost-users@lists.boost.org
Date: Wednesday, June 18, 2008, 2:10 PM
Hello,
I have searched a lot in every place what is the best way to convert a
string to a wstring (and may be vice versa). But til now I don`t got any
results. Can anyone give me an hint what is the best way to do that
(also good performance?)? maybe there is something available to do that?
may be also with some examples.
Thanks
Hansjörg
_______________________________________________
Boost-users mailing list
Boost-users@lists.boost.org
http://lists.boost.org/mailman/listinfo.cgi/boost-users