Boost logo

Boost :

From: Thorsten Ottosen (nesotto_at_[hidden])
Date: 2003-12-29 04:11:32


"Dan W." <danw_at_[hidden]> wrote in message
news:6.0.0.22.0.20031229010502.027eb800_at_pcp.softhome.net...
> Not sure if this might be a good idea, but here it goes:
>
> Would it make sense to have pointer container specializations for
> auto_ptr<>, shared_ptr<> and weak_ptr<>, simply as a way of specifying the
> desired semantics?

It makes sense if you can show what purpose it should serve.

> I'm thinking, for instance,
>
> ptr_vector< auto_ptr<X> > would compile to same code, basically, as
> ptr_vector<X>, except: it would take auto_ptr<> as input, and return
> auto_ptr<> through functions that would otherwise return a pointer.

there is not any functions that return a pointer. The way I have implemented
the stuff
is by wrapping existing containers and you cannot put an auto_ptr into
standard containers;
you would have to use something special like NTL.

> ptr_vector< shared_ptr<X> > would allow pointer containers to share
> ownership, and would interface via shared_ptr<>'s; and...

what interface did you have in mind.?

> ptr_vector< weak_ptr<X> > might give us the advantage of simplified
> algorithmic syntax, etceteras, but not take ownership.

While the idea is nice, I need to be convinced. The current interface (and
the whole desing idea) is build
upon the idea of owning heap-allocated pointers and hiding them behind an
indirected interface.

br

Thorsten


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk