Boost logo

Boost :

From: Howard Hinnant (hinnant_at_[hidden])
Date: 2002-02-05 19:09:51


On Tuesday, February 5, 2002, at 06:49 PM, Rainer Deyke wrote:

>> Yes, these will all work. And they are all less efficient than
> moving
>> elements out of the way once (directly to where they belong),
> leaving
>> valid elements in their place and copying x directly into place.
>
> While this is technically true, they are also all potentially orders
> of magnitude faster than the naive copying approach. They are close
> enough to optimal that I am not sure if further optimization is worth
> it.

They are not close to optimal at all if T is a light weight class with
move semantics (like auto_ptr). In this case your alternatives are 2
and 3 times slower.

-Howard


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk