Boost logo

Boost :

From: Vladimir Prus (ghost_at_[hidden])
Date: 2005-03-30 10:25:28

Martin Bonner wrote:

>> While it's generally considered a bad practice to provide implicit
>> conversions, I think it would be good to provide such a conversion
>> for the boost::format class.
> [snip]
> Having been bit far too many times by bad implicit conversions, I would
> vote
> against such a change.ššIšdon'tšseešwhyšonešshouldn'tšpassšinšašformat
> object to a function (possibly for the function to add one argument to the
> format object).

And for implicit conversion to do any harm, you need to mistakenly pass
boost::format to a function which takes std::string, right? In this case,
boost::format will immediately throw and you'll detect the bug in no time.

> I still think that providing a member function with(), rather than an
> operator % would have been better.ššThenšonešcouldšwrite:
> which seems does seem neater than:
> If we are to change boost::format, I would prefer to add such a member
> function than an implicit conversion.

The 'with' function (or, maybe 'arg', like in QString), can be indeed neater
then parenthesis, though I still prefer


- Volodya

Boost list run by bdawes at, gregod at, cpdaniel at, john at