Boost logo

Boost Users :

From: Luke Elliott (luke_elliott_at_[hidden])
Date: 2006-04-13 13:49:38


I couldn't find anything on this in the list archives or the format
docs, but it seems likely to have been asked before so apologies if that
is the case.

I would expect something like:

boost::format fmt("%d");

fmt % char(0);
std::cout << fmt;

to output "0" given that %d is explicitly specified. This isn't the case
  (with VC++ 7.1 and GCC 3.4 at least, and presumably all others given
this is normal stream behaviour).

Obviously it can be worked around by casting to a non-char type, but
that seems a shame given the nature of the library and not having to
worry about type-safety too much.

So, is this by design or accident? If not by design, would it be
possible to change the behaviour (specialisation somewhere for
(unsigned) char types or something??)?

Thanks in advance

Luke Elliott.


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net