1 | #include <stdio.h>
|
---|
2 | #include <tchar.h>
|
---|
3 | #include <crtdbg.h>
|
---|
4 |
|
---|
5 |
|
---|
6 | #include <boost/archive/binary_oarchive.hpp>
|
---|
7 | #include <boost/serialization/export.hpp>
|
---|
8 |
|
---|
9 | class Base {
|
---|
10 | friend class boost::serialization::access;
|
---|
11 | template<class Archive>
|
---|
12 | void serialize(Archive & ar, const unsigned int version)
|
---|
13 | { }
|
---|
14 |
|
---|
15 | virtual void vTest(
|
---|
16 | ) { }
|
---|
17 | };
|
---|
18 |
|
---|
19 | class Level1 : public Base {
|
---|
20 | friend class boost::serialization::access;
|
---|
21 | template<class Archive>
|
---|
22 | void serialize(Archive & ar, const unsigned int version)
|
---|
23 | { ar & boost::serialization::base_object<Base>(*this); }
|
---|
24 | };
|
---|
25 |
|
---|
26 | class Level2 : public Level1 {
|
---|
27 | friend class boost::serialization::access;
|
---|
28 | template<class Archive>
|
---|
29 | void serialize(Archive & ar, const unsigned int version)
|
---|
30 | { ar & boost::serialization::base_object<Level1>(*this); }
|
---|
31 | };
|
---|
32 |
|
---|
33 | class Level3 : public Level2 {
|
---|
34 | friend class boost::serialization::access;
|
---|
35 | template<class Archive>
|
---|
36 | void serialize(Archive & ar, const unsigned int version)
|
---|
37 | { ar & boost::serialization::base_object<Level2>(*this); }
|
---|
38 | };
|
---|
39 |
|
---|
40 | class Level4 : public Level3 {
|
---|
41 | friend class boost::serialization::access;
|
---|
42 | template<class Archive>
|
---|
43 | void serialize(Archive & ar, const unsigned int version)
|
---|
44 | { ar & boost::serialization::base_object<Level3>(*this); }
|
---|
45 | };
|
---|
46 |
|
---|
47 | BOOST_CLASS_EXPORT(Base)
|
---|
48 | BOOST_CLASS_EXPORT(Level1)
|
---|
49 | BOOST_CLASS_EXPORT(Level2)
|
---|
50 | BOOST_CLASS_EXPORT(Level3)
|
---|
51 | BOOST_CLASS_EXPORT(Level4)
|
---|
52 |
|
---|
53 | int _tmain(int argc, _TCHAR* argv[])
|
---|
54 | {
|
---|
55 | _CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF);
|
---|
56 | return 0;
|
---|
57 | }
|
---|