Boost C++ Libraries: Ticket #11612: serializing vector https://svn.boost.org/trac10/ticket/11612 <p> In &lt;boost/serialization/vector.hpp&gt; when dispatching to the default load method and detail::is_default_constructible&lt;U&gt; fails, should the vector be cleared if it is not empty? line 98 reserves capacity for the vector and line 102 pushes new elements into the vector. so if the vector is loaded multiple times its size will grow. if you try to load a vector starting with a vector that is not empty, the vector size will grow. </p> <p> should you do the following check: </p> <p> if(!t.empty()) t.clear(); t.reserve(count); </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/11612 Trac 1.4.3 thetetrismaster@… Wed, 02 Sep 2015 13:11:41 GMT attachment set https://svn.boost.org/trac10/ticket/11612 https://svn.boost.org/trac10/ticket/11612 <ul> <li><strong>attachment</strong> → <span class="trac-field-new">vector.hpp</span> </li> </ul> Ticket thetetrismaster@… Wed, 02 Sep 2015 16:50:53 GMT <link>https://svn.boost.org/trac10/ticket/11612#comment:1 </link> <guid isPermaLink="false">https://svn.boost.org/trac10/ticket/11612#comment:1</guid> <description> <p> also, in my particular context, detail::is_default_constructible&lt;<a class="missing wiki">MyClass</a>&gt; is failing when it should not be since <a class="missing wiki">MyClass</a> is indeed default constructible. I checked: </p> <p> std::is_default_constructible&lt;std::vector&lt;MyClass&gt;&gt;::value == true </p> <p> but </p> <p> boost::serialization::detail::is_default_constructible&lt;std::vector&lt;MyClass&gt;&gt;::value == false </p> <p> I also believe that the BOOST_NO_CXX11_HDR_TYPE_TRAITS flag is not being set properly. </p> </description> <category>Ticket</category> </item> <item> <dc:creator>Robert Ramey</dc:creator> <pubDate>Mon, 28 Sep 2015 05:00:02 GMT</pubDate> <title>status changed; resolution set https://svn.boost.org/trac10/ticket/11612#comment:2 https://svn.boost.org/trac10/ticket/11612#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">invalid</span> </li> </ul> <p> The code cited is from version 1.58. </p> <p> Currently we are in version 1.59 and the code has changed in order not to use is_default_constructble. </p> <p> so this report is not applicable. </p> Ticket