1//////////////////////////////////////////////////////////////////////////////
2//
3// (C) Copyright Ion Gaztanaga 2004-2012. Distributed under the Boost
4// Software License, Version 1.0. (See accompanying file
5// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
6//
7// See http://www.boost.org/libs/interprocess for documentation.
8//
9//////////////////////////////////////////////////////////////////////////////
10
11#include <boost/interprocess/managed_shared_memory.hpp>
12#include <boost/interprocess/containers/list.hpp>
13#include <boost/interprocess/containers/vector.hpp>
14#include <boost/interprocess/allocators/node_allocator.hpp>
15#include "print_container.hpp"
16#include "dummy_test_allocator.hpp"
17#include "movable_int.hpp"
18#include "list_test.hpp"
19#include "vector_test.hpp"
20
21using namespace boost::interprocess;
22
23//We will work with wide characters for shared memory objects
24//Alias an integer node allocator type
25typedef node_allocator
26 <int, managed_shared_memory::segment_manager> shmem_node_allocator_t;
27typedef ipcdetail::node_allocator_v1
28 <int, managed_shared_memory::segment_manager> shmem_node_allocator_v1_t;
29
30namespace boost {
31namespace interprocess {
32
33//Explicit instantiations to catch compilation errors
34template class node_allocator<int, managed_shared_memory::segment_manager>;
35template class node_allocator<void, managed_shared_memory::segment_manager>;
36
37namespace ipcdetail {
38
39template class ipcdetail::node_allocator_v1<int, managed_shared_memory::segment_manager>;
40template class ipcdetail::node_allocator_v1<void, managed_shared_memory::segment_manager>;
41
42}}}
43
44//Alias list types
45typedef list<int, shmem_node_allocator_t> MyShmList;
46typedef list<int, shmem_node_allocator_v1_t> MyShmListV1;
47
48//Alias vector types
49typedef vector<int, shmem_node_allocator_t> MyShmVector;
50typedef vector<int, shmem_node_allocator_v1_t> MyShmVectorV1;
51
52int main ()
53{
54 if(test::list_test<managed_shared_memory, MyShmList, true>())
55 return 1;
56 if(test::list_test<managed_shared_memory, MyShmListV1, true>())
57 return 1;
58 if(test::vector_test<managed_shared_memory, MyShmVector>())
59 return 1;
60 if(test::vector_test<managed_shared_memory, MyShmVectorV1>())
61 return 1;
62 return 0;
63}
64

source code of boost/libs/interprocess/test/node_allocator_test.cpp