diff --git a/doc/release_notes.html b/doc/release_notes.html index 853fed8..f28446b 100644 --- a/doc/release_notes.html +++ b/doc/release_notes.html @@ -78,6 +78,13 @@ Acknowledgements of equivalent elements (issue #68). +
  • Serialization now uses std::size_t instead of unsigned long + to save and load the size of a multi_index_container + (unsigned long is smaller than std::size_t in LLP64 data models). + multi_index_container serialization + class version has been + bumped from 3 to 4 to reflect this change. +
  • @@ -786,7 +793,7 @@ Acknowledgements
    -

    Revised May 21st 2023

    +

    Revised May 22nd 2023

    © Copyright 2003-2023 Joaquín M López Muñoz. Distributed under the Boost Software diff --git a/include/boost/multi_index_container.hpp b/include/boost/multi_index_container.hpp index ac73754..8ac43fc 100644 --- a/include/boost/multi_index_container.hpp +++ b/include/boost/multi_index_container.hpp @@ -1119,7 +1119,7 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS: template void save(Archive& ar,const unsigned int version)const { - const unsigned long s(size_()); + const std::size_t s(size_()); const detail::serialization_version value_version; ar< value_version; if(version<1){ std::size_t sz; ar>>core::make_nvp("count",sz); - s=static_cast(sz); + s=static_cast(sz); } else if(version<3){ #if defined(BOOST_MULTI_INDEX_ENABLE_SERIALIZATION_COMPATIBILITY_V2) serialization::collection_size_type csz; ar>>core::make_nvp("count",csz); - s=static_cast(csz); + s=static_cast(csz); #else ar>>core::make_nvp("count",s); #endif } + else if(version<4){ + unsigned long ul; + ar>>core::make_nvp("count",ul); + s=static_cast(ul); + } else{ ar>>core::make_nvp("count",s); } + if(version<2){ value_version=0; } @@ -1569,6 +1575,8 @@ void swap( * class version = 3 : dropped boost::serialization::collection_size_type * in favor of unsigned long --this allows us to provide serialization * support without including any header from Boost.Serialization. + * class version = 4 : uses std::size_t rather than unsigned long (which + * is smaller in LLP64 data models). */ namespace serialization { @@ -1577,7 +1585,7 @@ struct version< boost::multi_index_container > { - BOOST_STATIC_CONSTANT(int,value=3); + BOOST_STATIC_CONSTANT(int,value=4); }; } /* namespace serialization */ #endif