Boost C++ Libraries: Ticket #3579: [ptr_container] ptr_vector<T>::resize creates uninitialized objects if T is a POD https://svn.boost.org/trac10/ticket/3579 <p> ptr_vector&lt;T&gt;::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. </p> <p> Test: #include &lt;cassert&gt; </p> <p> #include &lt;boost/ptr_container/ptr_vector.hpp&gt; </p> <p> int main() { </p> <blockquote> <p> boost::ptr_vector&lt;int&gt; v; </p> </blockquote> <blockquote> <p> v.resize(1); </p> </blockquote> <blockquote> <p> assert(v<a class="missing changeset" title="No changeset 0 in the repository">[0]</a> == 0); <em> Might fail. </em></p> </blockquote> <p> } </p> <p> ptr_circullar_buffer has the same problem. </p> <p> I'm attaching a patch that fixes the problem. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/3579 Trac 1.4.3 roman.perepelitsa@… Thu, 29 Oct 2009 15:32:31 GMT attachment set https://svn.boost.org/trac10/ticket/3579 https://svn.boost.org/trac10/ticket/3579 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">ptr_container.diff</span> </li> </ul> <p> Patch with the fix </p> Ticket Steven Watanabe Thu, 29 Oct 2009 16:24:37 GMT component changed; owner set https://svn.boost.org/trac10/ticket/3579#comment:1 https://svn.boost.org/trac10/ticket/3579#comment:1 <ul> <li><strong>owner</strong> set to <span class="trac-author">Thorsten Ottosen</span> </li> <li><strong>component</strong> <span class="trac-field-old">None</span> → <span class="trac-field-new">ptr_container</span> </li> </ul> Ticket anonymous Fri, 30 Oct 2009 14:43:09 GMT status changed; resolution set https://svn.boost.org/trac10/ticket/3579#comment:2 https://svn.boost.org/trac10/ticket/3579#comment:2 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">closed</span> </li> <li><strong>resolution</strong> → <span class="trac-field-new">fixed</span> </li> </ul> <p> Patch applied to trunk. </p> <p> Thanks </p> <p> -Thorsten </p> Ticket roman.perepelitsa@… Fri, 30 Oct 2009 15:17:04 GMT <link>https://svn.boost.org/trac10/ticket/3579#comment:3 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3579#comment:3</guid> <description> <p> That was fast. Thanks! </p> </description> <category>Ticket</category> </item> <item> <dc:creator>anonymous</dc:creator> <pubDate>Tue, 09 Jul 2013 09:55:13 GMT</pubDate> <title/> <link>https://svn.boost.org/trac10/ticket/3579#comment:4 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/3579#comment:4</guid> <description> <p> class boost::ptr_vector&lt;XXX, boost::heap_clone_allocator, std::allocator&lt;void*&gt; &gt;' has no member named 'resize' </p> </description> <category>Ticket</category> </item> </channel> </rss>