Boost logo

Boost Users :

From: Mark Ruzon (mark34_at_[hidden])
Date: 2007-05-28 11:54:01


me22 <me22.ca <at> gmail.com> writes:

>
> On 26/05/07, Constantin Bryzgalin <constb <at> tomsk.ru> wrote:
> > Hello,
> >
> > > Can anyone tell me why std::vector < boost::ptr_vector < T > > can not be
> > > reserved and resized I can not push_back anything inside vector, due to
> > > compile errors?
> >
> > well, creating a copy of ptr_vector raises question of pointer ownership.
> >
> My understanding is that copying a ptr_container will (once made
> legal) result in the cloning of all of its elements, which means that
> there is no ownership problem, but that it's quite expensive (which is
> why it's been prohibited).

I would hope that no one who writes useful algorithms tries to prohibit
reasonable actions from taking place just because they're expensive. It is not
up to library designers to save programmers from themselves; programmers can
always write inefficient code if they choose not to think carefully about what
they're doing. This is one of the founding principles of the Standard Template
Library, and one that should continue to guide Boost.

Mark Ruzon


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