Boost logo

Boost :

From: David Abrahams (dave_at_[hidden])
Date: 2008-06-24 02:07:35


Daniel James wrote:
> On 23/06/2008, Daniel James <daniel_james_at_[hidden]> wrote:
>> 2008/6/23 David Abrahams <dave_at_[hidden]>:
>> > I have a hunch that it would be really easy to add support for move-only
>> > types, though. Do you see any specific obstacles?
>
> I had a quick try at implementing move-only types. It looks like you're right:
>
> http://svn.boost.org/trac/boost/changeset/46631
>
> y.hpp contains the move-only type. The code might look familiar.

:-)

> It mostly works. I've found two problems so far. Firstly,
> is_convertible didn't work for the type,

You found a bug in is_convertible?

> but I managed to work around
> that (I'll probably need to refine the change to is_movable).
> Secondly, it doesn't seem to be able to pass rvalues by reference. I'm
> not sure how to get round that, I'll have to learn more about the
> trick used to implement it.

IIRC there is a rule in C++03 that when binding a reference to an
rvalue, that rvalue must be copyable (and may in fact be copied at the
discretion of the compiler).

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