Boost C++ Libraries: Ticket #702: serializing empty vectors triggers STL assertion failure (VC https://svn.boost.org/trac10/ticket/702 <pre class="wiki">Serializing empty vectors triggers an STL assertion failure (VC++ 8.0). Test case: ========== typedef std::vector&lt;int&gt; vec_t; vec_t v; // empty vector { std::ofstream ofs("test.dat"); boost::archive::binary_oarchive oa(ofs); oa &lt;&lt; v; // triggers runtime assertion } The assertion is caused by line 31 in serialization/detail/get_data.hpp (note that vector v is empty): [0031] return &amp;(v[0]); Proposed fix: ============= Index: oarchive.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/archive/array/oarchive.hpp,v retrieving revision 1.3 diff -r1.3 oarchive.hpp 73c73 &lt; * this-&gt;This() &lt;&lt; serialization::make_array(serialization::detail::get_data(t),t.size()); --- &gt; if(count) * this-&gt;This() &lt;&lt; serialization::make_array(serialization::detail::get_data(t),t.size()); Index: iarchive.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/archive/array/iarchive.hpp,v retrieving revision 1.3 diff -r1.3 iarchive.hpp 77c77 &lt; * this-&gt;This() &gt;&gt; serialization::make_array(serialization::detail::get_data(t),t.size()); --- &gt; if(count) * this-&gt;This() &gt;&gt; serialization::make_array(serialization::detail::get_data(t),t.size()); </pre> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/702 Trac 1.4.3 Matthias Troyer Fri, 22 Sep 2006 17:57:46 GMT status changed https://svn.boost.org/trac10/ticket/702#comment:1 https://svn.boost.org/trac10/ticket/702#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">assigned</span> → <span class="trac-field-new">closed</span> </li> </ul> Ticket