
On Aug 26, 2004, at 7:03 PM, Thorsten Ottosen wrote:
I just wanted to hear if anybody had already made a move_ptr I could use?
Fwiw, there's a copyright-free move_ptr at: http://home.twcny.rr.com/hinnant/Utilities/move_ptr But I don't recommend it. I really like Dave's move implementation better, though it is less portable with current compilers (including Metrowerks). I also think move_ptr should carry a destructor policy in it's type: template<class T, class D = typename detail::default_delete<T>::type> class move_ptr; And I think it should be specialized on T[] for arrays: template<class T, class D> class move_ptr<T[], D>; And finally, I really am not happy with the name move_ptr, ironically. I was just this morning trying to think of a better name. How about owned_ptr? I was trying to contrast it with shared_ptr: With shared_ptr, many instances share ownership of a pointer. With move/owned_ptr, unique ownership is always assured. Bringing up another possibility: unique_ptr. I'm trying to stress the characteristic of sole ownership vs shared ownership, rather than the fact the pointer is movable. In the future, many types will be movable (even shared_ptr). So move_ptr is a really lousy name. I spent way too much time with the thesaurus this morning. ;-) -Howard