
Howard Hinnant <hinnant@twcny.rr.com> writes:
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:
My move implementation is more portable now. But for something that's movable but not copiable --- that's easier. Use Daniel's version, which is very portable.
And finally, I really am not happy with the name move_ptr, ironically.
Why not? Oh, below.
I was just this morning trying to think of a better name.
How about owned_ptr?
How is that different from auto_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.
single_ptr?
I spent way too much time with the thesaurus this morning. ;-)
I hope you two are good friends, now. -- Dave Abrahams Boost Consulting http://www.boost-consulting.com