Boost logo

Boost :

From: Rainer Deyke (root_at_[hidden])
Date: 2002-02-05 20:43:16


----- Original Message -----
From: "Howard Hinnant" <hinnant_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Tuesday, February 05, 2002 5:09 PM
Subject: Re: [boost] move semantics

> 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.

No: the time needed to move 'x' is likely to be dominated by the time
needed to make room for 'x'.

--
Rainer Deyke | root_at_[hidden] | http://rainerdeyke.com

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