
9 Jan
2009
9 Jan
'09
4:31 p.m.
Thorsten Ottosen wrote:
Hi,
In code like this:
std::string columns() const { return (boost::format("%7s, %7s, %7s, %7s") % "testCost" % "optimalEcr" % "efficiecyEcr" % "testCostEcr").str(); }
it is very annoying to have to put () around the whole expression and then call .str() (Just imagine that we are creating a string on the fly to a function).
Therefore I suggest that we add
operator string_type() const { return str(); }
to the interface of basic_format<>.
Any comments? You could write it as
return boost::str(boost::format("%7s, %7s, %7s, %7s") % "testCost" % "optimalEcr" % "efficiecyEcr" % "testCostEcr"); Sebastian