File indexing completed on 2025-12-16 10:08:45
0001 #ifndef BOOST_SERIALIZATION_SPLIT_FREE_HPP
0002 #define BOOST_SERIALIZATION_SPLIT_FREE_HPP
0003
0004
0005 #if defined(_MSC_VER)
0006 # pragma once
0007 #endif
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019 #include <boost/config.hpp>
0020 #include <boost/mpl/eval_if.hpp>
0021 #include <boost/mpl/identity.hpp>
0022 #include <boost/serialization/serialization.hpp>
0023
0024 namespace boost {
0025 namespace archive {
0026 namespace detail {
0027 template<class Archive> class interface_oarchive;
0028 template<class Archive> class interface_iarchive;
0029 }
0030 }
0031
0032 namespace serialization {
0033
0034 template<class Archive, class T>
0035 struct free_saver {
0036 static void invoke(
0037 Archive & ar,
0038 const T & t,
0039 const unsigned int file_version
0040 ){
0041
0042
0043 const version_type v(file_version);
0044 save(ar, t, v);
0045 }
0046 };
0047 template<class Archive, class T>
0048 struct free_loader {
0049 static void invoke(
0050 Archive & ar,
0051 T & t,
0052 const unsigned int file_version
0053 ){
0054
0055
0056 const version_type v(file_version);
0057 load(ar, t, v);
0058 }
0059 };
0060
0061 template<class Archive, class T>
0062 inline void split_free(
0063 Archive & ar,
0064 T & t,
0065 const unsigned int file_version
0066 ){
0067 typedef typename mpl::eval_if<
0068 typename Archive::is_saving,
0069 mpl::identity< free_saver<Archive, T> >,
0070 mpl::identity< free_loader<Archive, T> >
0071 >::type typex;
0072 typex::invoke(ar, t, file_version);
0073 }
0074
0075 }
0076 }
0077
0078 #define BOOST_SERIALIZATION_SPLIT_FREE(T) \
0079 namespace boost { namespace serialization { \
0080 template<class Archive> \
0081 inline void serialize( \
0082 Archive & ar, \
0083 T & t, \
0084 const unsigned int file_version \
0085 ){ \
0086 split_free(ar, t, file_version); \
0087 } \
0088 }}
0089
0090
0091 #endif