From: "Howard Hinnant" <[EMAIL PROTECTED]>

> 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:
>
> http://home.twcny.rr.com/hinnant/Utilities/move_ptr

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
constructor.

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

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost

Reply via email to