Boost logo

Boost :

Subject: Re: [boost] [lexical_cast] cast of int8_t
From: John Bytheway (jbytheway+boost_at_[hidden])
Date: 2012-10-13 19:57:54


On 13/10/12 16:35, Jochen Wilhelmy wrote:
> another question is why does lexical_cast treat int8_t and uint8_t like
> char? technically I see no reason for this as c++ has three types: char,
> signed char and unsigned char. in my code I use only char for characters
> and signed/unsigned char as numbers. I know that the standard stream
> operator << treats signed/unsigned char as char but I know no
> explanation for this (I consider it a bug ;-)

Whatever we think of the standard streams' decision (and indeed I agree
it's dubious), lexical_cast behaves in this way because it is defined in
terms of the standard streams. Personally I think that is the right
choice. Consistency is more important than tweaking each individual case.

John


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