From: Samuel Krempp (krempp_at_[hidden])
Date: 2004-01-21 16:14:29
On Wed, 2004-01-14 at 11:42, Russell Hind wrote:
> Pavel Vozenilek wrote:
> > This makes following code uncompilable (it worked back in 1.30.2):
> > boost:format f;
> > f = ".....";
> I've hit this too. Now use
> f = boost::format("....");
> But don't know how much less efficient this is because of the copy.
well in fact it does the exact same copying as the previous line (it was
implicitly creating a format object, then assigning it. it was not a
direct assignment from string).
efficiency-wise, copying the vector inside the format object is not a
If you want the most efficient way to parse a new string, it's
f.parse(" ... ");
I've tried to have this function reuse as much as it can of its
But in fact, It turned out it's not as important as I thought. I
analysed format's performance and what overhead could be avoided, and
the slowest thing is creating a stream object for each formatted item,
and there's no way to avoid that while keeping correct semantics in the
general case - think caller using xalloc inside custom manipulators, and
format can't be sure to know how to restore a full stream state)
I'm preparing a performances notice for the documentation so that users
know what to expect and how to obtain the least possible overhead.
> I wonder why it was removed.
I had forgotten at first to make the constructor explicit, but implicit
conversion from string was not intentional, like most implicit
conversions it brings more risks than convenience worth.
So I changed it to explicit once I noticed it wasn't.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk