Boost logo

Boost :

Subject: Re: [boost] [interest] underlying type library
From: Dave Abrahams (dave_at_[hidden])
Date: 2011-08-24 16:49:34


on Wed Aug 24 2011, Julian Gonggrijp <j.gonggrijp-AT-gmail.com> wrote:

> So what you are saying is: in practice there is no difference between
> a raw move and a destructive move. Point taken. But in that case the
> name 'raw move' seems to cover the semantics much better than
> 'destructive move'.

Meh. I don't care about the naming much one way or another.

>>> A raw move on the other hand can only be used if you are reordering
>>> values within the same scope.
>>
>> ? I presume that I can do swap(x,y) no matter what x and y's scope are.
>
> Correct. 'Within the same scope' was meant to refer to the reordering,
> not to the values. That is, once you start a chain of raw moves, you
> have to close that chain within the same scope in order to provide a
> validity guarantee to calling clients.

OK, that makes sense.

> With hindsight, I should have realised much earlier in this thread
> that this is also the reason why every operation between the start and
> the end of a chain of raw moves must be exception-free.

Well, if underlying_type<T> defaults to T and raw_move(x) defaults to
move(x), then I suppose we could use this approach to optimize
algorithms such as rotate for many types without losing general
correctness. It's less clear that algorithms that use swap would
benefit, but they might.

-- 
Dave Abrahams
BoostPro Computing
http://www.boostpro.com

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