Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-01-18 09:53:21

0001 /* Copyright 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 https://www.boost.org/libs/unordered for library home page.
0007  */
0008 
0009 #ifndef BOOST_UNORDERED_DETAIL_SERIALIZATION_VERSION_HPP
0010 #define BOOST_UNORDERED_DETAIL_SERIALIZATION_VERSION_HPP
0011 
0012 #include <boost/config.hpp>
0013 #include <boost/core/serialization.hpp>
0014 
0015 namespace boost{
0016 namespace unordered{
0017 namespace detail{
0018 
0019 /* boost::serialization::load_construct_adl(ar,t,version) requires user code
0020  * to pass the serialization version for t, when this information is really
0021  * stored in the archive. serialization_version<T> circumvents this design
0022  * error by acting as a regular serializable type with the same serialization
0023  * version as T; loading/saving serialization_version<T> does nothing with
0024  * the archive data itself but captures the stored serialization version
0025  * at load() time.
0026  */
0027 
0028 template<typename T>
0029 struct serialization_version
0030 {
0031   serialization_version():
0032     value(boost::serialization::version<serialization_version>::value){}
0033 
0034   serialization_version& operator=(unsigned int x){value=x;return *this;};
0035 
0036   operator unsigned int()const{return value;}
0037 
0038 private:
0039   friend class boost::serialization::access;
0040 
0041   template<class Archive>
0042   void serialize(Archive& ar,unsigned int version)
0043   {
0044     core::split_member(ar,*this,version);
0045   }
0046 
0047   template<class Archive>
0048   void save(Archive&,unsigned int)const{}
0049 
0050   template<class Archive>
0051   void load(Archive&,unsigned int version)
0052   {
0053     this->value=version;
0054   }
0055 
0056   unsigned int value;
0057 };
0058 
0059 } /* namespace detail */
0060 } /* namespace unordered */
0061 
0062 namespace serialization{
0063 
0064 template<typename T>
0065 struct version<boost::unordered::detail::serialization_version<T> >
0066 {
0067   BOOST_STATIC_CONSTANT(int,value=version<T>::value);
0068 };
0069 
0070 } /* namespace serialization */
0071 
0072 } /* namespace boost */
0073 
0074 #endif