Boost logo

Boost :

From: Alexander Nasonov (alnsn_at_[hidden])
Date: 2007-05-16 15:25:28


Phil Endecott wrote:
> ...
> Q: What does lexical_cast<string> of an int8_t or uint8_t not do what I expect?
> A: As above, note that int8_t and uint8_t are actually chars and are
> formatted as such. To avoid this, cast to an integer type first: lexical_cast<string>(static_cast<int>(n)).

Actually, you can write it a bit shorter: lexical_cast<string>(+n) ;-)

New revision is available at http://194.6.223.221/~nasonov/lexical_cast.htm

-- 
Alexander Nasonov
http://nasonov.blogspot.com
The greater our knowledge increases the more our ignorance unfolds.
-- John F. Kennedy --
This quote is generated by: 
	/usr/pkg/bin/curl -L http://tinyurl.com/veusy         \
	  | sed -e 's/^document\.write(.//' -e 's/.);$/ --/'  \
	        -e 's/<[^>]*>//g' -e 's/^More quotes from //' \
	  | fmt | tee ~/.signature-quote

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