1#ifndef BOOST_SERIALIZATION_SPLIT_MEMBER_HPP
2#define BOOST_SERIALIZATION_SPLIT_MEMBER_HPP
3
4// MS compatible compilers support #pragma once
5#if defined(_MSC_VER)
6# pragma once
7#endif
8
9/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
10// split_member.hpp:
11
12// (C) Copyright 2002 Robert Ramey - http://www.rrsd.com .
13// Use, modification and distribution is subject to the Boost Software
14// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
15// http://www.boost.org/LICENSE_1_0.txt)
16
17// See http://www.boost.org for updates, documentation, and revision history.
18
19#include <boost/config.hpp>
20#include <boost/mpl/eval_if.hpp>
21#include <boost/mpl/identity.hpp>
22
23#include <boost/serialization/access.hpp>
24
25namespace boost {
26namespace archive {
27 namespace detail {
28 template<class Archive> class interface_oarchive;
29 template<class Archive> class interface_iarchive;
30 } // namespace detail
31} // namespace archive
32
33namespace serialization {
34namespace detail {
35
36 template<class Archive, class T>
37 struct member_saver {
38 static void invoke(
39 Archive & ar,
40 const T & t,
41 const unsigned int file_version
42 ){
43 access::member_save(ar, t, file_version);
44 }
45 };
46
47 template<class Archive, class T>
48 struct member_loader {
49 static void invoke(
50 Archive & ar,
51 T & t,
52 const unsigned int file_version
53 ){
54 access::member_load(ar, t, file_version);
55 }
56 };
57
58} // detail
59
60template<class Archive, class T>
61inline void split_member(
62 Archive & ar, T & t, const unsigned int file_version
63){
64 typedef typename mpl::eval_if<
65 typename Archive::is_saving,
66 mpl::identity<detail::member_saver<Archive, T> >,
67 mpl::identity<detail::member_loader<Archive, T> >
68 >::type typex;
69 typex::invoke(ar, t, file_version);
70}
71
72} // namespace serialization
73} // namespace boost
74
75// split member function serialize funcition into save/load
76#define BOOST_SERIALIZATION_SPLIT_MEMBER() \
77template<class Archive> \
78void serialize( \
79 Archive &ar, \
80 const unsigned int file_version \
81){ \
82 boost::serialization::split_member(ar, *this, file_version); \
83} \
84/**/
85
86#endif // BOOST_SERIALIZATION_SPLIT_MEMBER_HPP
87

source code of boost/boost/serialization/split_member.hpp