"Matthias Kronenberger"
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.