Subject: Re: [boost] [move] moving temporaries of copyable types
From: klaus triendl (klaus_at_[hidden])
Date: 2009-06-24 05:04:25
Ion GaztaÃ±aga schrieb:
> klaus triendl wrote:
>> I've recently taken a look at the Boost.Move library and it seems that
>> it is only possible to make 1) either non-copyable types movable or 2)
>> make copyable types move-aware by explicitly moving them.
>> Now, I've discovered for myself that it is possible for pre-c++09
>> compilers to make copyable types *implicitly* movable by detecting
>> temporaries that can be moved.
>> So, my question is whether this is well-known and this feature was
>> deliberately excluded from Boost.Move or nobody has discovered it yet.
>> It would be great to have support for copy- and (implicit)
> Sorry for not catching this yet because I can't find time to fully
> understand your approach and do some portability tests. Just to make
> things a bit easier when I have some time, what do you mean with "make
> copyable types *implicitly* movable"? Can you give me a concrete example
> of what's possible with your approach that was not possible before?
Ok, I'm working on my ability to explain :)
return clone_ptr<int>(new int(1));
// Boost.Move ---> temporary gets copied
// my approach ---> temporary gets moved
p = return_rvalue();
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk