Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/multi_index/test/test_serialization1.cpp @ 35

Last change on this file since 35 was 29, checked in by landauf, 16 years ago

updated boost from 1_33_1 to 1_34_1

File size: 1.5 KB
Line 
1/* Boost.MultiIndex test for serialization, part 1.
2 *
3 * Copyright 2003-2006 Joaquín M López Muñoz.
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_serialization.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
20using namespace boost::multi_index;
21
22void test_serialization1()
23{
24  {
25    typedef multi_index_container<
26      int,
27      indexed_by<
28        sequenced<>,
29        sequenced<>,
30        random_access<>
31      >
32    > multi_index_t;
33
34    multi_index_t m;
35    for(int i=0;i<100;++i)m.push_back(i);
36    m.reverse();
37    test_serialization(m);
38
39    m.clear();
40    for(int j=50;j<100;++j)m.push_back(j);
41    for(int k=0;k<50;++k)m.push_back(k);
42    m.sort();
43    test_serialization(m);
44  }
45  {
46    typedef multi_index_container<
47      int,
48      indexed_by<
49        random_access<>,
50        sequenced<>,
51        ordered_non_unique<identity<int> >
52      >
53    > multi_index_t;
54
55    multi_index_t m;
56    for(int i=0;i<100;++i){
57      m.push_back(i);
58      m.push_back(i);
59      m.push_back(i);
60    }
61    m.reverse();
62    test_serialization(m);
63  }
64}
Note: See TracBrowser for help on using the repository browser.