Boost logo

Boost Users :

From: Matthias Kronenberger (mkronen_at_[hidden])
Date: 2002-07-31 18:48:43


Hm, what's the point in having such collections?
The pointers in a container would refer to data that is stored somewhere.
Since we want to minimize side effects, the only valid use of a pointer
container would be to store a set
of polymorphic objects.
Even now, the ownership question is raised. So, one should use a smart
pointer.

To adapt the pointers for the standard algorithm of the STL, one could use a
projection iterator adapter.

----- Original Message -----
From: "Bohdan" <yg-boost-users_at_[hidden]>
Newsgroups: gmane.comp.lib.boost.user
Sent: Thursday, August 01, 2002 12:49 AM
Subject: collection container

> Has boost any plans on creating container, that holds data by pointer, not
> by
> value?
>
> Rationale:
> It is impossible to use normally vector<...> for types that do not have
> copy constructor. Interface of vector< shared_ptr<...> > doesn't seems to
be
> very convenient( for example with std::algorithms ).
> And most of all it is not good idea to show vector< shared_ptr<...> >
> interface to
> user of my lib, that wants to have container::iterator with normal
behavior.
>
> AFAIK majority of existing libraries have/need such container ?
> As to me it is strange that neither stl nor boost have such class.
> I'm missing 'something' and there are important reasons for
> not doing this ?
>
>
>
>
>
>


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net