|
Boost : |
From: Martin Bonner (martin.bonner_at_[hidden])
Date: 2005-03-30 09:32:44
> 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).
I still think that providing a member function with(), rather than an
operator % would have been better. Then one could write:
string s = format("%1%").with(10).str();
which seems does seem neater than:
string s = (format("%1%") % 10).str();
If we are to change boost::format, I would prefer to add such a member
function than an implicit conversion.
-- Martin Bonner Martin.Bonner_at_[hidden] Pi Technology, Milton Hall, Ely Road, Milton, Cambridge, CB4 6WZ, ENGLAND Tel: +44 (0)1223 441434
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk