• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* Boost.MultiIndex test for serialization, part 1.
2  *
3  * Copyright 2003-2008 Joaquin M Lopez Munoz.
4  * Distributed under the Boost Software License, Version 1.0.
5  * (See accompanying file LICENSE_1_0.txt or copy at
6  * http://www.boost.org/LICENSE_1_0.txt)
7  *
8  * See http://www.boost.org/libs/multi_index for library home page.
9  */
10 
11 #include "test_serialization1.hpp"
12 #include "test_serialization_template.hpp"
13 
14 #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
15 #include <boost/multi_index/ordered_index.hpp>
16 #include <boost/multi_index/sequenced_index.hpp>
17 #include <boost/multi_index/random_access_index.hpp>
18 #include <boost/multi_index/key_extractors.hpp>
19 #include "non_std_allocator.hpp"
20 
21 using namespace boost::multi_index;
22 
test_serialization1()23 void test_serialization1()
24 {
25   {
26     typedef multi_index_container<
27       int,
28       indexed_by<
29         sequenced<>,
30         sequenced<>,
31         random_access<>
32       >
33     > multi_index_t;
34 
35     multi_index_t m;
36     for(int i=0;i<100;++i)m.push_back(i);
37     m.reverse();
38     test_serialization(m);
39 
40     m.clear();
41     for(int j=50;j<100;++j)m.push_back(j);
42     for(int k=0;k<50;++k)m.push_back(k);
43     m.sort();
44     test_serialization(m);
45   }
46   {
47     typedef multi_index_container<
48       int,
49       indexed_by<
50         random_access<>,
51         sequenced<>,
52         ordered_non_unique<identity<int> >
53       >,
54       non_std_allocator<int>
55     > multi_index_t;
56 
57     multi_index_t m;
58     for(int i=0;i<100;++i){
59       m.push_back(i);
60       m.push_back(i);
61       m.push_back(i);
62     }
63     m.reverse();
64     test_serialization(m);
65   }
66 }
67