From: Schoenborn, Oliver (Oliver.Schoenborn_at_[hidden])
Date: 2002-03-27 08:39:18
I needed a smart pointer that works for stuff that auto_ptr was not meant to
do, and that shared_ptr was not meant to do either: a pointer owner (as
opposed to an owned pointer) that is in charge of deep copy and deletion
when owner goes out of scope, coupled with a pointer user that only provides
pure shared usage (no ownership) tied to an owner.
This provides for a nice separation of roles and responsibilities, since
often an object is created in one place and not used, but given to another
object for usage but not management. An owned pointer is provided that
brings the two together for the cases where this is necessary.
I haven't seen anything else like it anywhere. It's clean, standard code,
exception safe, documented, but well tested with gcc and SGI's CC only, not
boost-standard and not thread-safe yet. I'm adding a better cloning
algorithm to improve efficiency and usability.
I'm assuming there is a reason for boost not providing pointer
ownership/usage objects, but if I'm wrong and there is interest I can make
it available to boost. Note that I'm away till Apr 8th so it won't happen
till then, unless it's a trivial process (can't remember at this moment).
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk