diff --git a/doc/release_notes.html b/doc/release_notes.html index 87f2b00..39170b9 100644 --- a/doc/release_notes.html +++ b/doc/release_notes.html @@ -73,6 +73,16 @@ Acknowledgements

@@ -764,9 +774,9 @@ Acknowledgements
-

Revised December 28th 2022

+

Revised February 26th 2023

-

© Copyright 2003-2022 Joaquín M López Muñoz. +

© Copyright 2003-2023 Joaquín M López Muñoz. Distributed under the Boost Software License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at diff --git a/include/boost/multi_index/detail/archive_constructed.hpp b/include/boost/multi_index/detail/archive_constructed.hpp index 43d3687..0b94d1f 100644 --- a/include/boost/multi_index/detail/archive_constructed.hpp +++ b/include/boost/multi_index/detail/archive_constructed.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2022 Joaquin M Lopez Munoz. +/* Copyright 2003-2023 Joaquin M Lopez Munoz. * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) @@ -16,7 +16,7 @@ #include /* keep it first to prevent nasty warns in MSVC */ #include #include -#include +#include #include #include @@ -34,7 +34,7 @@ struct archive_constructed:private noncopyable template archive_constructed(Archive& ar,const unsigned int version) { - serialization::load_construct_data_adl(ar,&get(),version); + core::load_construct_data_adl(ar,&get(),version); BOOST_TRY{ ar>>get(); } @@ -48,9 +48,9 @@ struct archive_constructed:private noncopyable template archive_constructed(const char* name,Archive& ar,const unsigned int version) { - serialization::load_construct_data_adl(ar,&get(),version); + core::load_construct_data_adl(ar,&get(),version); BOOST_TRY{ - ar>>serialization::make_nvp(name,get()); + ar>>core::make_nvp(name,get()); } BOOST_CATCH(...){ (&get())->~T(); diff --git a/include/boost/multi_index/detail/bad_archive_exception.hpp b/include/boost/multi_index/detail/bad_archive_exception.hpp new file mode 100644 index 0000000..2db4a39 --- /dev/null +++ b/include/boost/multi_index/detail/bad_archive_exception.hpp @@ -0,0 +1,36 @@ +/* Copyright 2003-2023 Joaquin M Lopez Munoz. + * Distributed under the Boost Software License, Version 1.0. + * (See accompanying file LICENSE_1_0.txt or copy at + * http://www.boost.org/LICENSE_1_0.txt) + * + * See http://www.boost.org/libs/multi_index for library home page. + */ + +#ifndef BOOST_MULTI_INDEX_DETAIL_BAD_ARCHIVE_EXCEPTION_HPP +#define BOOST_MULTI_INDEX_DETAIL_BAD_ARCHIVE_EXCEPTION_HPP + +#if defined(_MSC_VER) +#pragma once +#endif + +#include /* keep it first to prevent nasty warns in MSVC */ +#include + +namespace boost{ + +namespace multi_index{ + +namespace detail{ + +struct bad_archive_exception:std::runtime_error +{ + bad_archive_exception():std::runtime_error("Invalid or corrupted archive"){} +}; + +} /* namespace multi_index::detail */ + +} /* namespace multi_index */ + +} /* namespace boost */ + +#endif diff --git a/include/boost/multi_index/detail/bidir_node_iterator.hpp b/include/boost/multi_index/detail/bidir_node_iterator.hpp index adfb77d..5cc49e2 100644 --- a/include/boost/multi_index/detail/bidir_node_iterator.hpp +++ b/include/boost/multi_index/detail/bidir_node_iterator.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2018 Joaquin M Lopez Munoz. +/* Copyright 2003-2023 Joaquin M Lopez Munoz. * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) @@ -17,8 +17,7 @@ #include #if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) -#include -#include +#include #endif namespace boost{ @@ -67,7 +66,11 @@ public: * see explanation in safe_mode_iterator notes in safe_mode.hpp. */ - BOOST_SERIALIZATION_SPLIT_MEMBER() + template + void serialize(Archive& ar,const unsigned int version) + { + core::split_member(ar,*this,version); + } typedef typename Node::base_type node_base_type; @@ -75,14 +78,14 @@ public: void save(Archive& ar,const unsigned int)const { node_base_type* bnode=node; - ar< void load(Archive& ar,const unsigned int) { node_base_type* bnode; - ar>>serialization::make_nvp("pointer",bnode); + ar>>core::make_nvp("pointer",bnode); node=static_cast(bnode); } #endif diff --git a/include/boost/multi_index/detail/bucket_array.hpp b/include/boost/multi_index/detail/bucket_array.hpp index 04392d1..5d9efb4 100644 --- a/include/boost/multi_index/detail/bucket_array.hpp +++ b/include/boost/multi_index/detail/bucket_array.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2022 Joaquin M Lopez Munoz. +/* Copyright 2003-2023 Joaquin M Lopez Munoz. * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) @@ -27,8 +27,8 @@ #include #if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) -#include -#include +#include +#include #include #endif @@ -236,8 +236,7 @@ inline void load_construct_data( Archive&,boost::multi_index::detail::bucket_array*, const unsigned int) { - throw_exception( - archive::archive_exception(archive::archive_exception::other_exception)); + throw_exception(bad_archive_exception()); } #if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) diff --git a/include/boost/multi_index/detail/hash_index_iterator.hpp b/include/boost/multi_index/detail/hash_index_iterator.hpp index f5b0d0e..0bbcbdf 100644 --- a/include/boost/multi_index/detail/hash_index_iterator.hpp +++ b/include/boost/multi_index/detail/hash_index_iterator.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2020 Joaquin M Lopez Munoz. +/* Copyright 2003-2023 Joaquin M Lopez Munoz. * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) @@ -17,9 +17,7 @@ #include #if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) -#include -#include -#include +#include #endif namespace boost{ @@ -67,7 +65,11 @@ public: * see explanation in safe_mode_iterator notes in safe_mode.hpp. */ - BOOST_SERIALIZATION_SPLIT_MEMBER() + template + void serialize(Archive& ar,const unsigned int version) + { + core::split_member(ar,*this,version); + } typedef typename Node::base_type node_base_type; @@ -75,7 +77,7 @@ public: void save(Archive& ar,const unsigned int)const { node_base_type* bnode=node; - ar< @@ -89,11 +91,11 @@ public: Archive& ar,const unsigned int version,hashed_index_global_iterator_tag) { node_base_type* bnode; - ar>>serialization::make_nvp("pointer",bnode); + ar>>core::make_nvp("pointer",bnode); node=static_cast(bnode); if(version<1){ BucketArray* throw_away; /* consume unused ptr */ - ar>>serialization::make_nvp("pointer",throw_away); + ar>>core::make_nvp("pointer",throw_away); } } @@ -102,11 +104,11 @@ public: Archive& ar,const unsigned int version,hashed_index_local_iterator_tag) { node_base_type* bnode; - ar>>serialization::make_nvp("pointer",bnode); + ar>>core::make_nvp("pointer",bnode); node=static_cast(bnode); if(version<1){ BucketArray* buckets; - ar>>serialization::make_nvp("pointer",buckets); + ar>>core::make_nvp("pointer",buckets); if(buckets&&node&&node->impl()==buckets->end()->prior()){ /* end local_iterators used to point to end node, now they are null */ node=0; diff --git a/include/boost/multi_index/detail/index_loader.hpp b/include/boost/multi_index/detail/index_loader.hpp index cab79f0..93e0934 100644 --- a/include/boost/multi_index/detail/index_loader.hpp +++ b/include/boost/multi_index/detail/index_loader.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2022 Joaquin M Lopez Munoz. +/* Copyright 2003-2023 Joaquin M Lopez Munoz. * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) @@ -15,11 +15,11 @@ #include /* keep it first to prevent nasty warns in MSVC */ #include -#include #include +#include #include +#include #include -#include #include #include @@ -30,7 +30,8 @@ namespace multi_index{ namespace detail{ /* Counterpart of index_saver (check index_saver.hpp for serialization - * details.)* multi_index_container is in charge of supplying the info about + * details.) + * multi_index_container is in charge of supplying the info about * the base sequence, and each index can subsequently load itself using the * const interface of index_loader. */ @@ -47,14 +48,14 @@ public: template void add(Node* node,Archive& ar,const unsigned int) { - ar>>serialization::make_nvp("position",*node); + ar>>core::make_nvp("position",*node); entries()[n++]=node; } template void add_track(Node* node,Archive& ar,const unsigned int) { - ar>>serialization::make_nvp("position",*node); + ar>>core::make_nvp("position",*node); } /* A rearranger is passed two nodes, and is expected to @@ -102,7 +103,7 @@ private: FinalNode* unchecked_load_node(Archive& ar)const { Node* node=0; - ar>>serialization::make_nvp("pointer",node); + ar>>core::make_nvp("pointer",node); return static_cast(node); } @@ -110,7 +111,7 @@ private: FinalNode* load_node(Archive& ar)const { Node* node=0; - ar>>serialization::make_nvp("pointer",node); + ar>>core::make_nvp("pointer",node); check_node(node); return static_cast(node); } @@ -118,9 +119,7 @@ private: void check_node(Node* node)const { if(node!=0&&!std::binary_search(entries(),entries()+size_,node)){ - throw_exception( - archive::archive_exception( - archive::archive_exception::other_exception)); + throw_exception(bad_archive_exception()); } } diff --git a/include/boost/multi_index/detail/index_node_base.hpp b/include/boost/multi_index/detail/index_node_base.hpp index 1a1f0ca..d3229df 100644 --- a/include/boost/multi_index/detail/index_node_base.hpp +++ b/include/boost/multi_index/detail/index_node_base.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2016 Joaquin M Lopez Munoz. +/* Copyright 2003-2023 Joaquin M Lopez Munoz. * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) @@ -18,8 +18,8 @@ #include #if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) -#include -#include +#include +#include #include #endif @@ -117,8 +117,7 @@ inline void load_construct_data( Archive&,boost::multi_index::detail::index_node_base*, const unsigned int) { - throw_exception( - archive::archive_exception(archive::archive_exception::other_exception)); + throw_exception(bad_archive_exception()); } #if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) diff --git a/include/boost/multi_index/detail/index_saver.hpp b/include/boost/multi_index/detail/index_saver.hpp index 0f7b6ef..7126169 100644 --- a/include/boost/multi_index/detail/index_saver.hpp +++ b/include/boost/multi_index/detail/index_saver.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2022 Joaquin M Lopez Munoz. +/* Copyright 2003-2023 Joaquin M Lopez Munoz. * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) @@ -16,7 +16,7 @@ #include /* keep it first to prevent nasty warns in MSVC */ #include #include -#include +#include #include namespace boost{ @@ -43,14 +43,14 @@ public: template void add(Node* node,Archive& ar,const unsigned int) { - ar< void add_track(Node* node,Archive& ar,const unsigned int) { - ar< @@ -120,7 +120,7 @@ private: template static void save_node(Node* node,Archive& ar) { - ar< alg; diff --git a/include/boost/multi_index/detail/ord_index_impl.hpp b/include/boost/multi_index/detail/ord_index_impl.hpp index 93d47df..f7e6ced 100644 --- a/include/boost/multi_index/detail/ord_index_impl.hpp +++ b/include/boost/multi_index/detail/ord_index_impl.hpp @@ -80,8 +80,8 @@ #endif #if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) -#include #include +#include #include #include #endif @@ -1513,9 +1513,7 @@ private: } else if(comp_(key(x->value()),key(position->value()))){ /* inconsistent rearrangement */ - throw_exception( - archive::archive_exception( - archive::archive_exception::other_exception)); + throw_exception(bad_archive_exception()); } else index_node_type::increment(position); diff --git a/include/boost/multi_index/detail/rnd_node_iterator.hpp b/include/boost/multi_index/detail/rnd_node_iterator.hpp index 49fc422..7149cb0 100644 --- a/include/boost/multi_index/detail/rnd_node_iterator.hpp +++ b/include/boost/multi_index/detail/rnd_node_iterator.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2018 Joaquin M Lopez Munoz. +/* Copyright 2003-2023 Joaquin M Lopez Munoz. * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) @@ -17,8 +17,7 @@ #include #if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) -#include -#include +#include #endif namespace boost{ @@ -77,7 +76,11 @@ public: * see explanation in safe_mode_iterator notes in safe_mode.hpp. */ - BOOST_SERIALIZATION_SPLIT_MEMBER() + template + void serialize(Archive& ar,const unsigned int version) + { + core::split_member(ar,*this,version); + } typedef typename Node::base_type node_base_type; @@ -85,14 +88,14 @@ public: void save(Archive& ar,const unsigned int)const { node_base_type* bnode=node; - ar< void load(Archive& ar,const unsigned int) { node_base_type* bnode; - ar>>serialization::make_nvp("pointer",bnode); + ar>>core::make_nvp("pointer",bnode); node=static_cast(bnode); } #endif diff --git a/include/boost/multi_index/detail/safe_mode.hpp b/include/boost/multi_index/detail/safe_mode.hpp index 0ba6b44..b3fed3d 100644 --- a/include/boost/multi_index/detail/safe_mode.hpp +++ b/include/boost/multi_index/detail/safe_mode.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2022 Joaquin M Lopez Munoz. +/* Copyright 2003-2023 Joaquin M Lopez Munoz. * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) @@ -127,8 +127,7 @@ #include #if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) -#include -#include +#include #endif #if defined(BOOST_HAS_THREADS) @@ -556,7 +555,11 @@ private: friend class boost::serialization::access; - BOOST_SERIALIZATION_SPLIT_MEMBER() + template + void serialize(Archive& ar,const unsigned int version) + { + core::split_member(ar,*this,version); + } template void save(Archive& ar,const unsigned int version)const diff --git a/include/boost/multi_index/detail/serialization_version.hpp b/include/boost/multi_index/detail/serialization_version.hpp index ccd8bb4..1d5f0c8 100644 --- a/include/boost/multi_index/detail/serialization_version.hpp +++ b/include/boost/multi_index/detail/serialization_version.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2013 Joaquin M Lopez Munoz. +/* Copyright 2003-2023 Joaquin M Lopez Munoz. * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) @@ -14,8 +14,7 @@ #endif #include /* keep it first to prevent nasty warns in MSVC */ -#include -#include +#include namespace boost{ @@ -42,7 +41,11 @@ struct serialization_version private: friend class boost::serialization::access; - BOOST_SERIALIZATION_SPLIT_MEMBER() + template + void serialize(Archive& ar,const unsigned int version) + { + core::split_member(ar,*this,version); + } template void save(Archive&,const unsigned int)const{} diff --git a/include/boost/multi_index/hashed_index.hpp b/include/boost/multi_index/hashed_index.hpp index 71543d0..d4ba37a 100644 --- a/include/boost/multi_index/hashed_index.hpp +++ b/include/boost/multi_index/hashed_index.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2021 Joaquin M Lopez Munoz. +/* Copyright 2003-2023 Joaquin M Lopez Munoz. * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) @@ -55,7 +55,7 @@ #endif #if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) -#include +#include #endif #if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING) @@ -1238,14 +1238,14 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS: void save_( Archive& ar,const unsigned int version,const index_saver_type& sm)const { - ar< void load_(Archive& ar,const unsigned int version,const index_loader_type& lm) { - ar>>serialization::make_nvp("position",buckets); + ar>>core::make_nvp("position",buckets); super::load_(ar,version,lm); } #endif diff --git a/include/boost/multi_index_container.hpp b/include/boost/multi_index_container.hpp index 9840a65..ac73754 100644 --- a/include/boost/multi_index_container.hpp +++ b/include/boost/multi_index_container.hpp @@ -1,6 +1,6 @@ /* Multiply indexed container. * - * Copyright 2003-2021 Joaquin M Lopez Munoz. + * Copyright 2003-2023 Joaquin M Lopez Munoz. * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) @@ -53,13 +53,18 @@ #endif #if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION) +#include #include +#include #include -#include -#include -#include -#include #include + +#if defined(BOOST_MULTI_INDEX_ENABLE_SERIALIZATION_COMPATIBILITY_V2) +#define BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER \ + +#include BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER +#undef BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER +#endif #endif #if defined(BOOST_MULTI_INDEX_ENABLE_INVARIANT_CHECKING) @@ -1102,7 +1107,11 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS: friend class boost::serialization::access; - BOOST_SERIALIZATION_SPLIT_MEMBER() + template + void serialize(Archive& ar,const unsigned int version) + { + core::split_member(ar,*this,version); + } typedef typename super::index_saver_type index_saver_type; typedef typename super::index_loader_type index_loader_type; @@ -1110,15 +1119,15 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS: template void save(Archive& ar,const unsigned int version)const { - const serialization::collection_size_type s(size_()); + const unsigned long s(size_()); const detail::serialization_version value_version; - ar< value_version; if(version<1){ std::size_t sz; - ar>>serialization::make_nvp("count",sz); - s=static_cast(sz); + ar>>core::make_nvp("count",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); +#else + ar>>core::make_nvp("count",s); +#endif } else{ - ar>>serialization::make_nvp("count",s); + ar>>core::make_nvp("count",s); } if(version<2){ value_version=0; } else{ - ar>>serialization::make_nvp("value_version",value_version); + ar>>core::make_nvp("value_version",value_version); } index_loader_type lm(bfm_allocator::member,s); @@ -1157,9 +1175,7 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS: detail::archive_constructed value("item",ar,value_version); std::pair p=insert_rv_( value.get(),super::end().get_node()); - if(!p.second)throw_exception( - archive::archive_exception( - archive::archive_exception::other_exception)); + if(!p.second)throw_exception(detail::bad_archive_exception()); ar.reset_object_address( boost::addressof(p.first->value()),boost::addressof(value.get())); lm.add(p.first,ar,version); @@ -1550,6 +1566,9 @@ void swap( /* class version = 1 : we now serialize the size through * boost::serialization::collection_size_type. * class version = 2 : proper use of {save|load}_construct_data. + * 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. */ namespace serialization { @@ -1558,7 +1577,7 @@ struct version< boost::multi_index_container > { - BOOST_STATIC_CONSTANT(int,value=2); + BOOST_STATIC_CONSTANT(int,value=3); }; } /* namespace serialization */ #endif diff --git a/test/pair_of_ints.hpp b/test/pair_of_ints.hpp index 6089ffc..f4c31f8 100644 --- a/test/pair_of_ints.hpp +++ b/test/pair_of_ints.hpp @@ -1,6 +1,6 @@ /* Used in Boost.MultiIndex tests. * - * Copyright 2003-2010 Joaquin M Lopez Munoz. + * Copyright 2003-2023 Joaquin M Lopez Munoz. * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) @@ -12,7 +12,7 @@ #define BOOST_MULTI_INDEX_TEST_PAIR_OF_INTS_HPP #include /* keep it first to prevent nasty warns in MSVC */ -#include +#include struct pair_of_ints { @@ -66,8 +66,8 @@ namespace serialization{ template void serialize(Archive& ar,pair_of_ints& p,const unsigned int) { - ar&boost::serialization::make_nvp("first",p.first); - ar&boost::serialization::make_nvp("second",p.second); + ar&boost::core::make_nvp("first",p.first); + ar&boost::core::make_nvp("second",p.second); } #if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP)