Boost logo

Boost :

From: David Abrahams (david.abrahams_at_[hidden])
Date: 2002-02-02 17:19:56


I'd like to see this.

I'd like even better to see it done as an adaptor that can wrap any
container of pointers/smart pointers. That could be used as the substrate
for the indirect linear associative container implementation we've discussed
here not long ago.

-Dave
----- Original Message -----
From: "Mark Rodgers" <mark.rodgers_at_[hidden]>
To: <boost_at_[hidden]>
Sent: Saturday, February 02, 2002 4: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
> destroy).
>
> 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?
>
> Mark
>
>
>
> Info: http://www.boost.org Send unsubscribe requests to:
<mailto:boost-unsubscribe_at_[hidden]>
>
> 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