--- boost\format\feed_args.hpp 2007-12-15 19:49:13.000000000 +0100 +++ boost\format\feed_args.hpp 2012-07-05 19:17:43.000000000 +0100 @@ -92,12 +92,36 @@ template< class Ch, class Tr, class T> inline void put_head( BOOST_IO_STD basic_ostream & os, const group1& x ) { os << group_head(x.a1_); // send the first N-1 items, not the last } + template< class Ch, class Tr> inline + void put_last( BOOST_IO_STD basic_ostream & os, const char& x ) { + if (os.flags() & (std::ios_base::dec | std::ios_base::hex | std::ios_base::oct)) + os << static_cast(x); + else + os << x ; + } + + template< class Ch, class Tr> inline + void put_last( BOOST_IO_STD basic_ostream & os, const signed char& x ) { + if (os.flags() & (std::ios_base::dec | std::ios_base::hex | std::ios_base::oct)) + os << static_cast(x); + else + os << x ; + } + + template< class Ch, class Tr> inline + void put_last( BOOST_IO_STD basic_ostream & os, const unsigned char& x ) { + if (os.flags() & (std::ios_base::dec | std::ios_base::hex | std::ios_base::oct)) + os << static_cast(x); + else + os << x ; + } + template< class Ch, class Tr, class T> inline void put_last( BOOST_IO_STD basic_ostream & os, const T& x ) { os << x ; } template< class Ch, class Tr, class T> inline @@ -105,12 +129,36 @@ os << group_last(x.a1_); // this selects the last element } #ifndef BOOST_NO_OVERLOAD_FOR_NON_CONST template< class Ch, class Tr, class T> inline void put_head( BOOST_IO_STD basic_ostream &, T& ) { + } + + template< class Ch, class Tr> inline + void put_last( BOOST_IO_STD basic_ostream & os, char& x ) { + if (os.flags() & (std::ios_base::dec | std::ios_base::hex | std::ios_base::oct)) + os << static_cast(x); + else + os << x ; + } + + template< class Ch, class Tr> inline + void put_last( BOOST_IO_STD basic_ostream & os, signed char& x ) { + if (os.flags() & (std::ios_base::dec | std::ios_base::hex | std::ios_base::oct)) + os << static_cast(x); + else + os << x ; + } + + template< class Ch, class Tr> inline + void put_last( BOOST_IO_STD basic_ostream & os, unsigned char& x ) { + if (os.flags() & (std::ios_base::dec | std::ios_base::hex | std::ios_base::oct)) + os << static_cast(x); + else + os << x ; } template< class Ch, class Tr, class T> inline void put_last( BOOST_IO_STD basic_ostream & os, T& x) { os << x ; } --- boost\format\parsing.hpp 2009-05-20 20:19:00.000000000 +0100 +++ boost\format\parsing.hpp 2012-07-05 19:19:19.000000000 +0100 @@ -324,12 +324,15 @@ fpar->fmtstate_.flags_ &= ~std::ios_base::floatfield; break; case 'C': case 'c': fpar->truncate_ = 1; + + // Turn off dec flag such that put_last overloads won't up-cast to int. + fpar->fmtstate_.flags_ &= ~std::ios_base::dec; break; case 'S': case 's': if(precision_set) // handle truncation manually, with own parameter. fpar->truncate_ = fpar->fmtstate_.precision_; fpar->fmtstate_.precision_ = 6; // default stream precision.