Boost logo

Boost :

From: Bronek Kozicki (brok_at_[hidden])
Date: 2005-05-26 07:17:00


I believe that there is no reason why BOOST_NO_INTRINSIC_WCHAR_T should
be taken into account when defining DISABLE_WIDE_CHAR_SUPPORT at the
beginning of lexical_cast.hpp file. The fact that on some platform
wchar_t is not builtin type (as it should be) but some typedef (e.g. to
short), should not disable wchar_t support in lexical_cast. If platform
does not have any support for wchar_t then other macros (e.g.
BOOST_NO_STD_WSTRING) will be defined, leading to definition of
DISABLE_WIDE_CHAR_SUPPORT. On the other hand, if some platform emulates
wchar_t and has decent support for wide strings, wide streams etc, then
there is no real reason to disable lexical_cast support for wchar_t on
such platform.

My coleague was just bitten by this when trying to use lexical_cast on
MSVC6:

>>>> citation begin
Using Microsoft Visual Studio 6 and DinkumWare 2.3 Standard library, I
was prevented from using lexical_cast with wide strings. The
BOOST_NO_INTRINSIC_WCHAR_T was defined, which prevents the wide
character parts of lexical_cast from being compiled. Reading the
documentation on BOOST_NO_INTRINSIC_WCHAR_T, it would seem that this was
not used appropriately in lexical_cast.hpp

By removing the line from lexical_cast.hpp I was able to successfully
compile and use lexcical_cast with wstring.

Modified lexical_cast.hpp.

In this section :

#if defined(BOOST_NO_STRINGSTREAM) || \
    defined(BOOST_NO_STD_WSTRING) || \
    defined(BOOST_NO_STD_LOCALE) || \
    defined(BOOST_NO_INTRINSIC_WCHAR_T)

removed || \ defined(BOOST_NO_INTRINSIC_WCHAR_T)

>>>> citation end

I hope that our findings are correct and this can be fixed in release
1.33 . Regards

B.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk