From: Peter Dimov (pdimov_at_[hidden])
Date: 2003-02-03 10:01:55
From: "Howard Hinnant" <hinnant_at_[hidden]>
> move_ptr<int> source();
> move_ptr<int> i(source()); // move with copy syntax from rvalue, ok.
> move_ptr<int> j(i); // error, move with copy syntax from lvalue, bad!
> move_ptr<int> k(move(i)); // move with move syntax from lvalue, ok.
> I presented code under the thread "SmartPtr (Loki) - auto_ptr/move
> c'tor issue" on Jan. 28 which does this. For easy reference, here is
> the code again, slightly improved:
Amazing. I had to change &get to &move_ptr::get but apart from that, it
works. This is even more loophole-exploiting than the original auto_ptr;
auto_ptr at least had the decency to include a public and defined copy
I'm still not sure whether this answers the original smart_ptr challenge,
which may be stated as:
template<class T, int K> class smart_ptr<T, K>;
// K == 0 -> scoped_ptr
// K == 1 -> move_ptr
// K == 2 -> counted_ptr
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk