Boost logo

Boost :

From: Rainer Deyke (root_at_[hidden])
Date: 2002-02-06 10:43:56


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

> On Tuesday, February 5, 2002, at 08:43 PM, Rainer Deyke wrote:
>
> > No: the time needed to move 'x' is likely to be dominated by the
time
> > needed to make room for 'x'.
>
> "Likely" is subject to debate. We were discussing this method:
>
> vector::insert(iterator position, size_type n, const value_type& x);
>
> The minimum time needed to make room for x is O(end()-position).
The
> minimum time needed to move x is O(n). It all depends on the input
> parameters to insert.

<snip>

> Compare these alternatives to "option 4": Move elements out of the
way
> leaving constructed elements in their path. Copy assign the x into
> place:
>
> O(end()-position) move out of the way. O(n) copy assign into place.

That just leaves you with the weak exception guarantee, but I concede
the point. So I guess this means we need at least two variants of
move-construction, and probably separate 'std::vector::insert'
specializations for both of them.

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