Boost logo

Boost Users :

From: Bohdan (yg-boost-users_at_[hidden])
Date: 2002-08-01 04:12:12


"Matthias Kronenberger" <mkronen_at_[hidden]> wrote in message
news:000501c238ec$cdd152c0$5ab2f683_at_koe5isewcagsnh...
> Hm, what's the point in having such collections?
> The pointers in a container would refer to data that is stored somewhere.

ok. What if your class hasn't copy constructor or you don't want to
copy your object ... have you other choice ?

> Since we want to minimize side effects, the only valid use of a pointer
> container would be to store a set
> of polymorphic objects.

Sure, this is another purpose for implementing it.

> Even now, the ownership question is raised. So, one should use a smart
> pointer.

You are right. If you look again on my previous posting you will see
something about shared_ptr< ... >.

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

   I know about projection iterator and iterator adaptor library.
And i didn't tell that it is impossible to use vector< smart_ptr<...> > with
std::algorithms, i said that it is just uncomfortable.
   Of course you can use iterator adaptor and be happy, but you
can use such cumbersome code only internally. If you are making
your own library ( for example GUI lib), you should supply clean
and simple interface to user! Or you want to explain to user how to
use iterator adaptor with your strange container ?

   As i can see the only good solution is to make separate container
or at least some container adaptor.


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