$include_dir="/home/hyper-archives/boost/include"; include("$include_dir/msg-header.inc") ?>
Subject: Re: [boost] C++03 unique_ptr emulation
From: Ion Gaztañaga (igaztanaga_at_[hidden])
Date: 2009-01-09 15:15:51
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?
How can that work? What would you need to add to T? Disable non-const 
copy constructor?
> Yeah, I know it's not theoretically portable, but it should be portable
> in practice.  Especially when it comes to emulating language features, I
> care less and less about the letter of the law :-)
I would be really interested in this proposal.
Regards,
Ion