Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:42:09

0001 /* Copyright 2003-2023 Joaquin M Lopez Munoz.
0002  * Distributed under the Boost Software License, Version 1.0.
0003  * (See accompanying file LICENSE_1_0.txt or copy at
0004  * http://www.boost.org/LICENSE_1_0.txt)
0005  *
0006  * See http://www.boost.org/libs/multi_index for library home page.
0007  */
0008 
0009 #ifndef BOOST_MULTI_INDEX_DETAIL_SERIALIZATION_VERSION_HPP
0010 #define BOOST_MULTI_INDEX_DETAIL_SERIALIZATION_VERSION_HPP
0011 
0012 #if defined(_MSC_VER)
0013 #pragma once
0014 #endif
0015 
0016 #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
0017 #include <boost/core/serialization.hpp>
0018 
0019 namespace boost{
0020 
0021 namespace multi_index{
0022 
0023 namespace detail{
0024 
0025 /* Helper class for storing and retrieving a given type serialization class
0026  * version while avoiding saving the number multiple times in the same
0027  * archive.
0028  * Behavior undefined if template partial specialization is not supported.
0029  */
0030 
0031 template<typename T>
0032 struct serialization_version
0033 {
0034   serialization_version():
0035     value(boost::serialization::version<serialization_version>::value){}
0036 
0037   serialization_version& operator=(unsigned int x){value=x;return *this;};
0038 
0039   operator unsigned int()const{return value;}
0040 
0041 private:
0042   friend class boost::serialization::access;
0043 
0044   template<class Archive>
0045   void serialize(Archive& ar,const unsigned int version)
0046   {
0047     core::split_member(ar,*this,version);
0048   }
0049 
0050   template<class Archive>
0051   void save(Archive&,const unsigned int)const{}
0052 
0053   template<class Archive>
0054   void load(Archive&,const unsigned int version)
0055   {
0056     this->value=version;
0057   }
0058 
0059   unsigned int value;
0060 };
0061 
0062 } /* namespace multi_index::detail */
0063 
0064 } /* namespace multi_index */
0065 
0066 namespace serialization {
0067 template<typename T>
0068 struct version<boost::multi_index::detail::serialization_version<T> >
0069 {
0070   BOOST_STATIC_CONSTANT(int,value=version<T>::value);
0071 };
0072 } /* namespace serialization */
0073 
0074 } /* namespace boost */
0075 
0076 #endif