Subject: [Boost-bugs] [Boost C++ Libraries] #6515: Serilaization of std::vector<bool> is broken for optimizing archives
From: Boost C++ Libraries (noreply_at_[hidden])
Date: 2012-02-02 18:40:38
#6515: Serilaization of std::vector<bool> is broken for optimizing archives
------------------------------+---------------------------------------------
Reporter: hkaiser | Owner: ramey
Type: Bugs | Status: new
Milestone: To Be Determined | Component: serialization
Version: Boost 1.48.0 | Severity: Problem
Keywords: |
------------------------------+---------------------------------------------
Serializing a vector<bool> causes corruptions in the created archive. The
reason is this function (in boost/serialization/vector.hpp):
{{{
template<class Archive, class U, class Allocator>
inline void save(
Archive & ar,
const std::vector<U, Allocator> &t,
const unsigned int /* file_version */,
mpl::true_
){
const collection_size_type count(t.size());
ar << BOOST_SERIALIZATION_NVP(count);
if (!t.empty())
ar << make_array(detail::get_data(t),t.size());
}
}}}
While detail::get_data(t) is not specialized for std::vector<bool> (but it
should be), and t.size() returns the number of bits stored in the vector,
which is probably not what's expected either.
I'm encountering this problem with MSVC10, 64bit, Windows7.
-- Ticket URL: <https://svn.boost.org/trac/boost/ticket/6515> Boost C++ Libraries <http://www.boost.org/> Boost provides free peer-reviewed portable C++ source libraries.
This archive was generated by hypermail 2.1.7 : 2017-02-16 18:50:08 UTC