|
Boost : |
From: Drazen DOTLIC (Drazen.Dotlic_at_[hidden])
Date: 2003-07-18 07:51:05
Hello boosters,
I've encountered something I can not claim to be a problem, but would
like to consult with you (or at least author of lexical_cast). We are
using VC7.1, boost from CVS few weeks old, and building Unicode
applications. Naturally, we use std::wstring all over the place, and
lexical_cast on some of the places.
But boost deliberately forbids wide character usage in lexical_cast
unless _NATIVE_WCHAR_T_DEFINED is defined - from
config/compiler/visualc.hpp:
#ifndef _NATIVE_WCHAR_T_DEFINED
# define BOOST_NO_INTRINSIC_WCHAR_T
#endif
And then in lexical_cast.hpp:
#if defined(BOOST_NO_STRINGSTREAM) || \
defined(BOOST_NO_STD_WSTRING) || \
defined(BOOST_NO_STD_LOCALE) || \
defined(BOOST_NO_INTRINSIC_WCHAR_T)
#define DISABLE_WIDE_CHAR_SUPPORT
#endif
Why is this? I don't see big problem in the fact that wchar_t is just a
typedef _in this context_? Before you even begin :) to preach, yes, I am
aware of problems, and would gladly turn on /Zc:wchar_t compiler option
on, but I can't - some of the 3rd party open source libraries that we
use in our projects break, and fixing them would be a pain in the ass,
not to mention maintenance later.
Now, I see that we can't just disable the first of the above mentioned
macros, because then a lot of other code depending on the difference
between unsinged short and wchar_t would fail, but maybe we could patch
lexical_cast to still work even when wchar_t is not a real type?
Otherwise, I see no way to use lexical_cast and boost on Windows in
Unicode builds unless /Zc:wchar_t is on, and that is not always an
option as I've explained above. It appears that just by deleting
"defined(BOOST_NO_INTRINSIC_WCHAR_T)" from the second macro works fine,
could that be the solution (would be conditionally off for Windows only,
of course)?
I hope I wasn't too chaotic and you understood my question.
Thanks in advance for any help,
Drazen
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk