From: David Abrahams (dave_at_[hidden])
Date: 2006-02-17 21:48:02
Thorsten Ottosen <tottosen_at_[hidden]> writes:
> David Abrahams wrote:
>> Doug Gregor <dgregor_at_[hidden]> writes:
>>>I think the basic guarantee is enough here. Truly paranoid users can
>>>copy+swap themselves, but for most purposes you are better off not
>>>having two copies of the container in memory. Most people need better
>>>performance more than they need the strong guarantee.
>> That's one right way to look at it.
> Ok, so if efficiency really matters here, would it not
> be best not to call clear(), but try to assign to the
> existing elements or create them in-place in the container?
Yes, if efficiency really matters, and the container isn't empty, and
no other considerations contravene this, it would be better. However,
I think most of the time the container starts out empty anyway, and
there would only be savings in edge cases.
-- Dave Abrahams Boost Consulting www.boost-consulting.com
Boost list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk