$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [Boost-users] Why is boost::format::operator% not declared const?
From: Steve Lorimer (steve.lorimer_at_[hidden])
Date: 2013-01-15 20:49:41
> void CalledThousandsOfTimesPerSecondFromManyThreads(float f)
> {
> static const boost::format Formatter("%0.3f");
>
> GetStream() << Formatter % f << GetSomeOtherContent();
> }
>
> I'm pretty sure boost::format is not thread safe
If you think about what it's doing, every time you call operator% it's
inserting a formatted item into it's internal state.
Think about what happens if you feed multiple elements via operator% and
then call .str() - you get a std::string back - it has to store everything
you've fed in internally so that you can access the formatted string later
via .str()