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:
- You want the objects to remain at the same address even if you re-allocate the array under the vector?
- You want to inter-operate with a library that already deals with owing pointers?
- You want it to be faster than if you were storing values in
std::vector
?- You want the “polymorphic behavior” of your objects?
Add a Comment
Comments are closed.