A gotcha with ptr_vector -- Andrzej Krzemieński

Do you know Boost.Pointer Container? Andrzej gives some useful information in his recent blog entry:

A gotcha with ptr_vector

He gives answers to these questions:

What would you use boost::ptr_vector for? Why would you need to have a vector of pointers, which you want to delete yourself? Is it because:

  1. You want the objects to remain at the same address even if you re-allocate the array under the vector?
  2. You want to inter-operate with a library that already deals with owing pointers?
  3. You want it to be faster than if you were storing values in std::vector?
  4. You want the “polymorphic behavior” of your objects?

Add a Comment

Comments are closed.

Comments (0)

There are currently no comments on this entry.