
18 Feb
2006
18 Feb
'06
2:37 p.m.
David Abrahams wrote:
Thorsten Ottosen <tottosen@dezide.com> writes:
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.
The latter case "create them in-place in the container" still seems like something that will remove some overhead. Sad that the standard can help us here. -Thorsten