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/cached_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//Alias an integer node allocator type
24typedef cached_node_allocator
25 <int, managed_shared_memory::segment_manager>
26 cached_node_allocator_t;
27typedef ipcdetail::cached_node_allocator_v1
28 <int, managed_shared_memory::segment_manager>
29 cached_node_allocator_v1_t;
30
31namespace boost {
32namespace interprocess {
33
34//Explicit instantiations to catch compilation errors
35template class cached_node_allocator<int, managed_shared_memory::segment_manager>;
36template class cached_node_allocator<void, managed_shared_memory::segment_manager>;
37
38namespace ipcdetail {
39
40template class ipcdetail::cached_node_allocator_v1<int, managed_shared_memory::segment_manager>;
41template class ipcdetail::cached_node_allocator_v1<void, managed_shared_memory::segment_manager>;
42
43}}}
44
45//Alias list types
46typedef list<int, cached_node_allocator_t> MyShmList;
47typedef list<int, cached_node_allocator_v1_t> MyShmListV1;
48
49//Alias vector types
50typedef vector<int, cached_node_allocator_t> MyShmVector;
51typedef vector<int, cached_node_allocator_v1_t> MyShmVectorV1;
52
53int main ()
54{
55 if(test::list_test<managed_shared_memory, MyShmList, true>())
56 return 1;
57 if(test::list_test<managed_shared_memory, MyShmListV1, true>())
58 return 1;
59 if(test::vector_test<managed_shared_memory, MyShmVector>())
60 return 1;
61 if(test::vector_test<managed_shared_memory, MyShmVectorV1>())
62 return 1;
63 return 0;
64}
65

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