|
Boost : |
From: Howard Hinnant (hinnant_at_[hidden])
Date: 2002-02-05 13:34:27
On Tuesday, February 5, 2002, at 01:26 PM, Peter Dimov wrote:
> But isn't this inefficient? One of our goals is to eliminate copy
> constructors where possible, because they may do a deep-copy. The fast
> reallocation is either move-construct-from-object + destruct or
> move-construct-from-raw.
The only copy construction I mentioned (or intended to mention) was from
the input argument x:
vector::insert(iterator position, size_type n, const value_type& x);
All initial elements are moved (and only once).
> The "insert range in the middle" operation is problematic with #3, I
> admit.
> You could probably ensure capacity() for one extra element, copy
> construct
> at the end, then move around using that uninitialized slot as a
> temporary.
> :-)
Not in *my* vector! ;-)
-Howard
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk