Boost logo

Boost :

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


In code like this:

   std::string columns() const
         return (boost::format("%7s, %7s, %7s, %7s")
                    % "testCost" % "optimalEcr" % "efficiecyEcr" %

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?


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