Boost C++ Libraries: Ticket #6515: Serilaization of std::vector<bool> is broken for optimizing archives https://svn.boost.org/trac10/ticket/6515 <p> Serializing a vector&lt;bool&gt; causes corruptions in the created archive. The reason is this function (in boost/serialization/vector.hpp): </p> <pre class="wiki">template&lt;class Archive, class U, class Allocator&gt; inline void save( Archive &amp; ar, const std::vector&lt;U, Allocator&gt; &amp;t, const unsigned int /* file_version */, mpl::true_ ){ const collection_size_type count(t.size()); ar &lt;&lt; BOOST_SERIALIZATION_NVP(count); if (!t.empty()) ar &lt;&lt; make_array(detail::get_data(t),t.size()); } </pre><p> While detail::get_data(t) is not specialized for std::vector&lt;bool&gt; (but it should be), and t.size() returns the number of bits stored in the vector, which is probably not what's expected either. </p> <p> I'm encountering this problem with MSVC10, 64bit, Windows7. </p> en-us Boost C++ Libraries /htdocs/site/boost.png https://svn.boost.org/trac10/ticket/6515 Trac 1.4.3 Robert Ramey Sun, 15 Jul 2012 20:35:16 GMT status changed https://svn.boost.org/trac10/ticket/6515#comment:1 https://svn.boost.org/trac10/ticket/6515#comment:1 <ul> <li><strong>status</strong> <span class="trac-field-old">new</span> → <span class="trac-field-new">assigned</span> </li> </ul> <p> Hmmm - looks like a specialization of the serialization for vector&lt;bool&gt; is required. Care to submit one? While you're at it, how about all the type set&lt;bool&gt;? etc. </p> <p> I recognize that this a problem, but it is non-trivial and seems such a low priority that it would be hard for me to justify the effort to track down all the repercussions of fixing this, testing, etc. etc. However, if you want to do this I would support the effort and you would be rewarded with a thin slice of immortality by having your name included in the acknowledgements in the documentation and code comments/copyright. </p> <p> So I'm going to remove this from pending issues and put up for the things to do "some day". </p> <p> Robert Ramey </p> Ticket