Boost logo

Boost :

From: Mattias Flodin (flodin_at_[hidden])
Date: 2002-05-23 15:36:28


On Thu, May 23, 2002 at 02:39:34PM +0200, Terje Slettebø wrote:
> However, this does mean that the semantics is changed slightly. In the cases
> where an implicit conversion exists, it may give a different result than if
> not, in the case of char/wchar_t. Without implict conversion, you get 1 ->
> '1'. With implicit conversion, you get 1 -> 1 (ASCII 1). As far as I can
> tell, this only affects conversions between char/wchar_t and other types,
> though. If this is a problem, please let me know, and I can change it to
> make an exception for char/wchar_t.

Are you saying that lexical_cast<char>(int(1)) would give '\01'? This
seems to almost defeat the purpose of lexical_cast, if you ask me.

> - wlexical_cast - A version that can use wide characters
> - This is already handled by the previous version.

What I'd like though is for lexical_cast<wstring>(1) to work as
expected - i.e. produce a string with a wide-character lexical
representation of the number 1. Having to use a function with a
different name makes it pretty much impossible to write a program that
is transparent to the width of characters, without having to use
#define.

/Mattias

-- 
Mattias Flodin <flodin_at_[hidden]>  -  http://www.cs.umu.se/~flodin/
Room NADV 102
Department of Computing Science
Umeå University
S-901 87 Umeå, Sweden
--
"I must say that I find television very educational. The minute somebody
turns it on, I go to the library and read a book." -- Groucho Marx

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