cached_node_allocator_test.cpp

来自「Boost provides free peer-reviewed portab」· C++ 代码 · 共 60 行

CPP
60
字号
////////////////////////////////////////////////////////////////////////////////// (C) Copyright Ion Gaztanaga 2004-2008. Distributed under the Boost// Software License, Version 1.0. (See accompanying file// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)//// See http://www.boost.org/libs/interprocess for documentation.////////////////////////////////////////////////////////////////////////////////#include <boost/interprocess/detail/config_begin.hpp>#include <boost/interprocess/managed_shared_memory.hpp>#include <boost/interprocess/containers/list.hpp>#include <boost/interprocess/containers/vector.hpp>#include <boost/interprocess/allocators/cached_node_allocator.hpp>#include "print_container.hpp"#include "dummy_test_allocator.hpp"#include "movable_int.hpp"#include "list_test.hpp"#include "vector_test.hpp"using namespace boost::interprocess;//Alias an integer node allocator typetypedef cached_node_allocator   <int, managed_shared_memory::segment_manager>   cached_node_allocator_t;typedef detail::cached_node_allocator_v1   <int, managed_shared_memory::segment_manager>   cached_node_allocator_v1_t;//Explicit instantiations to catch compilation errorstemplate class cached_node_allocator<int, managed_shared_memory::segment_manager>;template class detail::cached_node_allocator_v1<int, managed_shared_memory::segment_manager>;template class cached_node_allocator<void, managed_shared_memory::segment_manager>;template class detail::cached_node_allocator_v1<void, managed_shared_memory::segment_manager>;//Alias list typestypedef list<int, cached_node_allocator_t>    MyShmList;typedef list<int, cached_node_allocator_v1_t> MyShmListV1;//Alias vector typestypedef vector<int, cached_node_allocator_t>    MyShmVector;typedef vector<int, cached_node_allocator_v1_t> MyShmVectorV1;int main (){   if(test::list_test<managed_shared_memory, MyShmList, true>())      return 1;   if(test::list_test<managed_shared_memory, MyShmListV1, true>())      return 1;   if(test::vector_test<managed_shared_memory, MyShmVector>())      return 1;   if(test::vector_test<managed_shared_memory, MyShmVectorV1>())      return 1;   return 0;}#include <boost/interprocess/detail/config_end.hpp>

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?