mirror of
https://github.com/boostorg/multi_index.git
synced 2025-05-09 23:14:04 +00:00
Merge branch 'develop'
This commit is contained in:
commit
261d31fb0f
@ -73,6 +73,16 @@ Acknowledgements
|
||||
|
||||
<p>
|
||||
<ul>
|
||||
<li>Serialization now uses <code>unsigned long</code> instead of
|
||||
<a href="../../serialization/doc/wrappers.html#collection_size_type"><code>collection_size_type</code></a>,
|
||||
and <code>multi_index_container</code> serialization
|
||||
<a href="../../serialization/doc/tutorial.html#versioning">class version</a> has been
|
||||
bumped from 2 to 3 to reflect this change.
|
||||
Reading old archives may fail for custom archive types giving special treatment to
|
||||
<code>collection_size_type</code> values: if this is the case, globally define
|
||||
the macro <code>BOOST_MULTI_INDEX_ENABLE_SERIALIZATION_COMPATIBILITY_V2</code>
|
||||
to ensure backwards compatibility in reading operations.
|
||||
</li>
|
||||
<li>Maintenance work.</li>
|
||||
</ul>
|
||||
</p>
|
||||
@ -764,9 +774,9 @@ Acknowledgements
|
||||
|
||||
<br>
|
||||
|
||||
<p>Revised December 28th 2022</p>
|
||||
<p>Revised February 26th 2023</p>
|
||||
|
||||
<p>© Copyright 2003-2022 Joaquín M López Muñoz.
|
||||
<p>© Copyright 2003-2023 Joaquín M López Muñoz.
|
||||
Distributed under the Boost Software
|
||||
License, Version 1.0. (See accompanying file <a href="../../../LICENSE_1_0.txt">
|
||||
LICENSE_1_0.txt</a> or copy at <a href="http://www.boost.org/LICENSE_1_0.txt">
|
||||
|
@ -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 <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/core/no_exceptions_support.hpp>
|
||||
#include <boost/core/noncopyable.hpp>
|
||||
#include <boost/serialization/serialization.hpp>
|
||||
#include <boost/core/serialization.hpp>
|
||||
#include <boost/type_traits/aligned_storage.hpp>
|
||||
#include <boost/type_traits/alignment_of.hpp>
|
||||
|
||||
@ -34,7 +34,7 @@ struct archive_constructed:private noncopyable
|
||||
template<class Archive>
|
||||
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<class Archive>
|
||||
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();
|
||||
|
36
include/boost/multi_index/detail/bad_archive_exception.hpp
Normal file
36
include/boost/multi_index/detail/bad_archive_exception.hpp
Normal file
@ -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 <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <stdexcept>
|
||||
|
||||
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
|
@ -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 <boost/operators.hpp>
|
||||
|
||||
#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/serialization/split_member.hpp>
|
||||
#include <boost/core/serialization.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
@ -67,7 +66,11 @@ public:
|
||||
* see explanation in safe_mode_iterator notes in safe_mode.hpp.
|
||||
*/
|
||||
|
||||
BOOST_SERIALIZATION_SPLIT_MEMBER()
|
||||
template<class Archive>
|
||||
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<<serialization::make_nvp("pointer",bnode);
|
||||
ar<<core::make_nvp("pointer",bnode);
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
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<Node*>(bnode);
|
||||
}
|
||||
#endif
|
||||
|
@ -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 <limits.h>
|
||||
|
||||
#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
#include <boost/serialization/access.hpp>
|
||||
#include <boost/core/serialization.hpp>
|
||||
#include <boost/multi_index/detail/bad_archive_exception.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#endif
|
||||
|
||||
@ -236,8 +236,7 @@ inline void load_construct_data(
|
||||
Archive&,boost::multi_index::detail::bucket_array<Allocator>*,
|
||||
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)
|
||||
|
@ -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 <boost/operators.hpp>
|
||||
|
||||
#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/serialization/split_member.hpp>
|
||||
#include <boost/serialization/version.hpp>
|
||||
#include <boost/core/serialization.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
@ -67,7 +65,11 @@ public:
|
||||
* see explanation in safe_mode_iterator notes in safe_mode.hpp.
|
||||
*/
|
||||
|
||||
BOOST_SERIALIZATION_SPLIT_MEMBER()
|
||||
template<class Archive>
|
||||
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<<serialization::make_nvp("pointer",bnode);
|
||||
ar<<core::make_nvp("pointer",bnode);
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
@ -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<Node*>(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<Node*>(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;
|
||||
|
@ -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 <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <algorithm>
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
#include <boost/core/noncopyable.hpp>
|
||||
#include <boost/core/serialization.hpp>
|
||||
#include <boost/multi_index/detail/auto_space.hpp>
|
||||
#include <boost/multi_index/detail/bad_archive_exception.hpp>
|
||||
#include <boost/multi_index/detail/raw_ptr.hpp>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
@ -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<class Archive>
|
||||
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<class Archive>
|
||||
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<FinalNode*>(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<FinalNode*>(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());
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -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 <boost/type_traits/alignment_of.hpp>
|
||||
|
||||
#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
#include <boost/serialization/access.hpp>
|
||||
#include <boost/core/serialization.hpp>
|
||||
#include <boost/multi_index/detail/bad_archive_exception.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#endif
|
||||
|
||||
@ -117,8 +117,7 @@ inline void load_construct_data(
|
||||
Archive&,boost::multi_index::detail::index_node_base<Value,Allocator>*,
|
||||
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)
|
||||
|
@ -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 <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/multi_index/detail/index_matcher.hpp>
|
||||
#include <boost/core/noncopyable.hpp>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/core/serialization.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
namespace boost{
|
||||
@ -43,14 +43,14 @@ public:
|
||||
template<class Archive>
|
||||
void add(Node* node,Archive& ar,const unsigned int)
|
||||
{
|
||||
ar<<serialization::make_nvp("position",*node);
|
||||
ar<<core::make_nvp("position",*node);
|
||||
alg.add(node);
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
void add_track(Node* node,Archive& ar,const unsigned int)
|
||||
{
|
||||
ar<<serialization::make_nvp("position",*node);
|
||||
ar<<core::make_nvp("position",*node);
|
||||
}
|
||||
|
||||
template<typename IndexIterator,class Archive>
|
||||
@ -120,7 +120,7 @@ private:
|
||||
template<typename Archive>
|
||||
static void save_node(Node* node,Archive& ar)
|
||||
{
|
||||
ar<<serialization::make_nvp("pointer",node);
|
||||
ar<<core::make_nvp("pointer",node);
|
||||
}
|
||||
|
||||
index_matcher::algorithm<Node,Allocator> alg;
|
||||
|
@ -80,8 +80,8 @@
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
|
||||
#include <boost/archive/archive_exception.hpp>
|
||||
#include <boost/bind/bind.hpp>
|
||||
#include <boost/multi_index/detail/bad_archive_exception.hpp>
|
||||
#include <boost/multi_index/detail/duplicates_iterator.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#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);
|
||||
|
||||
|
@ -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 <boost/operators.hpp>
|
||||
|
||||
#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/serialization/split_member.hpp>
|
||||
#include <boost/core/serialization.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
@ -77,7 +76,11 @@ public:
|
||||
* see explanation in safe_mode_iterator notes in safe_mode.hpp.
|
||||
*/
|
||||
|
||||
BOOST_SERIALIZATION_SPLIT_MEMBER()
|
||||
template<class Archive>
|
||||
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<<serialization::make_nvp("pointer",bnode);
|
||||
ar<<core::make_nvp("pointer",bnode);
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
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<Node*>(bnode);
|
||||
}
|
||||
#endif
|
||||
|
@ -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 <boost/type_traits/is_same.hpp>
|
||||
|
||||
#if !defined(BOOST_MULTI_INDEX_DISABLE_SERIALIZATION)
|
||||
#include <boost/serialization/split_member.hpp>
|
||||
#include <boost/serialization/version.hpp>
|
||||
#include <boost/core/serialization.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_HAS_THREADS)
|
||||
@ -556,7 +555,11 @@ private:
|
||||
|
||||
friend class boost::serialization::access;
|
||||
|
||||
BOOST_SERIALIZATION_SPLIT_MEMBER()
|
||||
template<class Archive>
|
||||
void serialize(Archive& ar,const unsigned int version)
|
||||
{
|
||||
core::split_member(ar,*this,version);
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
void save(Archive& ar,const unsigned int version)const
|
||||
|
@ -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 <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/serialization/split_member.hpp>
|
||||
#include <boost/serialization/version.hpp>
|
||||
#include <boost/core/serialization.hpp>
|
||||
|
||||
namespace boost{
|
||||
|
||||
@ -42,7 +41,11 @@ struct serialization_version
|
||||
private:
|
||||
friend class boost::serialization::access;
|
||||
|
||||
BOOST_SERIALIZATION_SPLIT_MEMBER()
|
||||
template<class Archive>
|
||||
void serialize(Archive& ar,const unsigned int version)
|
||||
{
|
||||
core::split_member(ar,*this,version);
|
||||
}
|
||||
|
||||
template<class Archive>
|
||||
void save(Archive&,const unsigned int)const{}
|
||||
|
@ -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 <boost/serialization/nvp.hpp>
|
||||
#include <boost/core/serialization.hpp>
|
||||
#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<<serialization::make_nvp("position",buckets);
|
||||
ar<<core::make_nvp("position",buckets);
|
||||
super::save_(ar,version,sm);
|
||||
}
|
||||
|
||||
template<typename Archive>
|
||||
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
|
||||
|
@ -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 <boost/core/serialization.hpp>
|
||||
#include <boost/multi_index/detail/archive_constructed.hpp>
|
||||
#include <boost/multi_index/detail/bad_archive_exception.hpp>
|
||||
#include <boost/multi_index/detail/serialization_version.hpp>
|
||||
#include <boost/serialization/collection_size_type.hpp>
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/serialization/split_member.hpp>
|
||||
#include <boost/serialization/version.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
|
||||
#if defined(BOOST_MULTI_INDEX_ENABLE_SERIALIZATION_COMPATIBILITY_V2)
|
||||
#define BOOST_MULTI_INDEX_BLOCK_BOOSTDEP_HEADER \
|
||||
<boost/serialization/collection_size_type.hpp>
|
||||
#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<class Archive>
|
||||
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<class Archive>
|
||||
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_type> value_version;
|
||||
ar<<serialization::make_nvp("count",s);
|
||||
ar<<serialization::make_nvp("value_version",value_version);
|
||||
ar<<core::make_nvp("count",s);
|
||||
ar<<core::make_nvp("value_version",value_version);
|
||||
|
||||
index_saver_type sm(bfm_allocator::member,s);
|
||||
|
||||
for(iterator it=super::begin(),it_end=super::end();it!=it_end;++it){
|
||||
serialization::save_construct_data_adl(
|
||||
core::save_construct_data_adl(
|
||||
ar,boost::addressof(*it),value_version);
|
||||
ar<<serialization::make_nvp("item",*it);
|
||||
sm.add(it.get_node(),ar,version);
|
||||
@ -1134,21 +1143,30 @@ BOOST_MULTI_INDEX_PROTECTED_IF_MEMBER_TEMPLATE_FRIENDS:
|
||||
BOOST_MULTI_INDEX_CHECK_INVARIANT;
|
||||
|
||||
clear_();
|
||||
serialization::collection_size_type s;
|
||||
unsigned long s;
|
||||
detail::serialization_version<value_type> value_version;
|
||||
if(version<1){
|
||||
std::size_t sz;
|
||||
ar>>serialization::make_nvp("count",sz);
|
||||
s=static_cast<serialization::collection_size_type>(sz);
|
||||
ar>>core::make_nvp("count",sz);
|
||||
s=static_cast<unsigned long>(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<unsigned long>(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> value("item",ar,value_version);
|
||||
std::pair<final_node_type*,bool> 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<Value,IndexSpecifierList,Allocator>
|
||||
>
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(int,value=2);
|
||||
BOOST_STATIC_CONSTANT(int,value=3);
|
||||
};
|
||||
} /* namespace serialization */
|
||||
#endif
|
||||
|
@ -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 <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/serialization/nvp.hpp>
|
||||
#include <boost/core/serialization.hpp>
|
||||
|
||||
struct pair_of_ints
|
||||
{
|
||||
@ -66,8 +66,8 @@ namespace serialization{
|
||||
template<class Archive>
|
||||
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)
|
||||
|
Loading…
x
Reference in New Issue
Block a user