
29 Oct
2009
29 Oct
'09
3:36 p.m.
ptr_vector<T>::resize creates new objects using 'new T' instead of 'new T()', which results in uninitialized objects if T is a POD. For consistency with STL containers (std::vector in particular) all PODs must be explicitly initialized. Test: #include <cassert> #include <boost/ptr_container/ptr_vector.hpp> int main() { boost::ptr_vector<int> v; v.resize(1); assert(v[0] == 0); // Might fail. } ptr_circullar_buffer has the same problem. I opened a trac ticket (https://svn.boost.org/trac/boost/ticket/3579) and attached a patch to it. Roman Perepelitsa.