From: Jani Kajala (jani_at_[hidden])
Date: 2002-02-02 17:14:42
Why not auto_ptr to vector of auto_ptrs?
----- Original Message -----
From: "Mark Rodgers" <mark.rodgers_at_[hidden]>
Sent: Saturday, February 02, 2002 11:28 PM
Subject: [boost] auto_vector - vector with auto_ptr semantics
> I have a class template I call auto_vector. It's a simple
> idea and I'm sure many others have done something similar
> but if no-one else is planning on submitting theirs, I'm
> happy to contribute mine.
> To summarise, it is a vector of pointers but it has the
> following differences from an ordinary vector:
> - Deletes its contained pointers on destruction.
> - Deletes erased elements in erase.
> - Copy and assignment have auto_ptr sematics, i.e. use an
> auto_vector_ref and clear the source object. I've
> implemented this using swap, so passing and returning
> auto_vectors by value is relatively cheap.
> - Adds an overloaded insert taking an auto_ptr which is
> shorthand for
> v.insert(pos, ap.get()); ap.release();
> - Adds a release function (erase but return instead of
> I can boostify the code really quickly (just change the
> namespace and copyright) and I have some tests. If there
> is any interest, I'll upload these to the vault and start
> on some documentation.
> Comments anyone?
> Info: http://www.boost.org Send unsubscribe requests to:
> Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk