string/wstring conversion using lexical_cast

Hi,
I'm using Boost 1.31.0 with VC++ 7.1 and I'm having some problems converting
std::string to std::wstring and back.
Here's the code that I'm trying to get to compile:
std::wstring x = boost::lexical_caststd::wstring(
std::string("this doesn't work"));
std::string y = boost::lexical_caststd::string(
std::wstring(L"neither does this"));
The error I get for string to wstring:
lexical_cast.hpp(150): error C2679: binary '>>' : no operator found which
takes a right-hand operand of type 'std::wstring' (or there is no acceptable
conversion)
And the errors I get for wstring to string:
lexical_cast.hpp(144): error C2679: binary '<<' : no operator found which
takes a right-hand operand of type 'const
std::basic_string<_Elem,_Traits,_Ax>' (or there is no acceptable conversion)
with
[
_Elem=wchar_t,
_Traits=std::char_traits

In article
I'm using Boost 1.31.0 with VC++ 7.1 and I'm having some problems converting std::string to std::wstring and back.
You can't do that. lexical_cast from X to Y requires that there is a stream to
which X can be written and from which Y can be read. However, string can only be
read from basic_stream<char> and wstring can only be written to
basic_stream
participants (2)
-
Miro Jurisic
-
Tony Djordjevski