Subject: Re: [boost] Boost.Algorithm design question
From: Phil Endecott (spam_from_boost_dev_at_[hidden])
Date: 2011-10-06 15:56:15
Stewart, Robert wrote:
> Christian Holmquist wrote:
>> The never ending reference to std::string vs const char*
>> performance thing.
> In the "meow" example above, forcing the construction of a std::string
> from the string literal implies a free store allocation which, in turn,
> generally implies a global lock. That means it can be a drag on MT
> performance. A library function shouldn't impose that if preventing
> or avoiding it is practicable.
Furthermore, constructing the temporary is O(N) in the length of the
string, while the comparison will often only need to look at the first element.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk