Boost logo

Boost Users :

From: Peter Klotz (peter.klotz_at_[hidden])
Date: 2003-03-23 01:42:37


> The code fragment below does not compile. The problem seems to be related
> to wide character support.
> MSVC6 works without problems.
>
> #include <boost/lexical_cast.hpp>
> int main(void)
> {
> boost::lexical_cast<std::string,unsigned short>(4);
> return 0;
> }

Meanwhile I found the cause of the problem. wchar_t is mapped to unsigned
short by default when using MSVC7.

To solve the problem, use the compiler flag /Zc:wchar_t. This makes wchar_t
a type of its own, independent of unsigned short.
So the template specialization for wchar_t is not used and the above code
compiles.

Best regards, Peter.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net