Boost logo

Boost :

Subject: Re: [boost] [format] please add operator String()
From: Hansi (hansipet_at_[hidden])
Date: 2009-02-06 08:35:01


Phil Endecott schrieb:
> Alex MDC wrote:
>>> Therefore I suggest that we add
>>>
>>> operator string_type() const { return str(); }
>>>
>>> to the interface of basic_format<>.
>>>
>>> Any comments?
>>>
>>
>> Sorry to dig this up, but I am +10 for this change.
>>
>> I'm currently in the process of removing hundreds of old fixed buffer +
>> sprintf() style log messages from our code and this would make my life a
>> *lot* easier (not to mention more readable).
>
> Hi Alex,
>
> Why do you prefer boost.format to sprintf? I gave up on boost.format
> when I realised that, like std::operator<< and boost::lexical_cast, it
> formats a uint8_t as a char even when I use %d. I now use something
> like this to get a std::string using sprintf syntax:

for me also +10 for the change.
maybe it should be considered to make work also %d for a uint8_t...

Hansjörg


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