logging-log4cxx-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "David M. Lee" <dm...@Crossroads.com>
Subject FW: logstream's wide character support
Date Thu, 13 Jul 2006 15:31:29 GMT
I've just been hit by an oddity about the way logstream behaves on a system that has wchar_t
support - even if you don't use (or care) about wide characters.
On such a system, logstream derives from basic_ios<wchar_t>.  This works fine for most
native types, but means that operator<< for ArbitraryType will try to invoke operator<<(wostream,
ArbitraryType) -  the wide character streaming operator.

If your type only defines operator<<(ostream, ArbitraryType), the compile will fail
with a big pile of STL errors (well, one error of no match for 'operator<<', with about
a gazillion candidates).
There are two solutions to this problem.
The first is to change my code to be wide-output friendly: operator<<(basic_ostream<C>,
ArbitraryType).  Easy enough, but produces a lot of clutter in code that will never need wide
character support.
What would be preferable would be for logstream to become a more direct model of ostream -
meaning that you have a basic_logstream<C>, with 'typedef basic_logstream<char>
logstream' and 'typedef basic_logstream<wchar_t> wlogstream'.

CONFIDENTIAL: This email, including its contents and attachments, if any, are confidential.
If the reader of this e-mail is not an intended recipient, you have received this e-mail in
error and any review, dissemination, distribution or copying is strictly prohibited. If you
have received this e-mail in error, please notify the sender immediately by return e-mail
at [emailaddress@crossroads.com] and permanently delete the copy you received. Copyright and
other intellectual property rights in its contents are the sole property of Crossroads Systems,
Inc. Email transmission cannot be guaranteed to be secure or error-free. The sender therefore
does not accept liability for any errors or omissions in the contents of the message which
arise as a result of email  transmission.  Although we routinely screen for viruses, addressees
should check this email and any attachments for viruses. We make no representation or warranty
as to the absence of viruses in this email or any attachments.

View raw message