Boost logo

Boost :

Subject: [boost] [format] please add operator String()
From: Thorsten Ottosen (thorsten.ottosen_at_[hidden])
Date: 2009-01-09 11:19:13


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?

-Thorsten


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