27 Dec
2004
27 Dec
'04
10:02 a.m.
Georgios Diamantopoulos
:
I am trying to convert from wchar_t to std::string with
#include <iostream> #include <sstream> #include
int main() { std::cout << boost::lexical_caststd::string(L"blah") << std::endl; return 0; }
but I get the following error: d:\SDK\boost\include\boost-1_32\boost\lexical_cast.hpp(158) : error C2679: binary '=' : no operator found which takes a right-hand operand of type 'std::basic_stringstream<_Elem,_Traits,_Alloc>::_Mystr' (or there is no acceptable conversion)
Any ideas? This is with boost 1.3.2 and VC7.1
lexical_cast won't convert between char and wchar_t (or strings of these). To convert from a wchar_t string literal, you need to convert to std::wstring. Regards, Terje