Boost logo

Boost :

Subject: Re: [boost] C++03 unique_ptr emulation
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2009-01-09 19:03:11


AMDG

David Abrahams wrote:
>> David Abrahams wrote:
>>
>>> So you're saying, in other words, that "move(x)" really means "you have
>>> permission to move x" but the one I proposed would mean "move it, now."
>>>
>>> OK, good point.
>>>
>>> So what about this horrible little proposal?
>>>
>>> template <class T>
>>> struct rv<T> : T
>>> {
>>> private:
>>> rv();
>>> ~rv();
>>> rv(rv const&);
>>> void operator=(rv const&);
>>> };
>>>
>>> template <class T>
>>> boost::enable_if<is_class<T>, rv<T>&>
>>> move(T& x)
>>> {
>>> return static_cast<rv<T>& >(x);
>>> }
>>>
>>> Does that solve any problems?
>>>
> Well, I haven't thought this through deeply (nor really tested
> anything), but the idea is that movable types would have a stealing
> conversion from rv<T>& but non-movable types should just use the copy
> ctor that slices off the non-existent derived class.
>

What if T has a fully generic constructor?

In Christ,
Steven Watanabe


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