|
Boost : |
From: Bronek Kozicki (brok_at_[hidden])
Date: 2004-01-20 10:37:48
Peter Dimov <pdimov_at_[hidden]> wrote:
> sink( pi ); // error, possibly unintended transfer
> sink( move(pi) ); // OK, Howard's preferred
> sink( pi.move() ); // I kind of like it better but it's not
I just came to this idea before reading your post :>
Small changes to move_ptr implementation will make it work:
move_ptr move()
{return move_ptr(*this);}
template <class U>
friend move_ptr<U> move(move_ptr<U>& p)
{return p;}
I admit I like more Howard's way. Anyway, definition of private cctor is
now required:
move_ptr(move_ptr& p)
: d_(p.d_), v_(p.v_),
t_(p.release())
{ }
B.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk