"Rodolfo Lima" <[EMAIL PROTECTED]> skrev i meddelandet news:[EMAIL PROTECTED] > I had some problems with lexical_cast and not using wchar_t as a built-in > type. For instance... > > std::stringstream ss; > ss << boost::lexical_cast<unsigned short>("23"); > > lexical_cast would return a wstring, and a compile failure, because > internally there is a the template that matches unsigned short as wchar_t, > which makes lexical_cast return a wstring. Or something like this. The fact > is that this example gives an cryptic compiler error (it was for me): > > boost\lexical_cast.hpp(147) : error C2679: binary '<<' : no operator found > which takes a right-hand operand of type 'const > boost::token_iterator_generator<TokenizerFunc,Iterator,Type>::value_ty pe' > (or there is no acceptable conversion) > > Maybe to avoid this kind of compiler error message, there's such requirement > of wchar_t being an native type.
There *is* such a requirement for VC7.1 ostream, which explicitly says: /* Note that if your stream is wchar_t, and you are not using native wchar_t Then this operation will be unavailable as there is an explicit specialisation further down this file that is designed to treat an unsigned short as a character. If you wish to read or write unsigned shorts to wchar_t streams, you should consider making wchar_t a native type by turning on /Zc:wchar_t */ _Myt& operator<<(unsigned short _Val) { ... Bo Persson [EMAIL PROTECTED] _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost