
Thorsten Ottosen <tottosen@dezide.com> writes:
David Abrahams wrote:
Doug Gregor <dgregor@cs.indiana.edu> 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