1 | #include <boost/archive/xml_iarchive.hpp>
|
---|
2 | #include <boost/serialization/vector.hpp>
|
---|
3 |
|
---|
4 | #include <vector>
|
---|
5 | #include <fstream>
|
---|
6 |
|
---|
7 | using namespace std;
|
---|
8 |
|
---|
9 | class non_def_ctable {
|
---|
10 | private:
|
---|
11 | friend class boost::serialization::access;
|
---|
12 |
|
---|
13 | template<class Archive>
|
---|
14 | void serialize(Archive& ar, const unsigned int) { ar & BOOST_SERIALIZATION_NVP( value ); }
|
---|
15 |
|
---|
16 | int value;
|
---|
17 |
|
---|
18 | public:
|
---|
19 | non_def_ctable() = delete;
|
---|
20 | non_def_ctable(int arg_value) : value( arg_value ) {}
|
---|
21 | };
|
---|
22 |
|
---|
23 | namespace boost {
|
---|
24 | namespace serialization {
|
---|
25 | template <typename Archive>
|
---|
26 | inline void load_construct_data(Archive &,
|
---|
27 | non_def_ctable * t,
|
---|
28 | const unsigned int
|
---|
29 | ) {
|
---|
30 | ::new(t)non_def_ctable( 0 );
|
---|
31 | }
|
---|
32 | }
|
---|
33 | }
|
---|
34 |
|
---|
35 | int main() {
|
---|
36 | ifstream the_input_stream;
|
---|
37 | boost::archive::xml_iarchive the_input_archive( the_input_stream );
|
---|
38 |
|
---|
39 | vector<non_def_ctable> non_def_ctables;
|
---|
40 |
|
---|
41 | the_input_archive & BOOST_SERIALIZATION_NVP( non_def_ctables );
|
---|
42 | }
|
---|
43 |
|
---|