////////////////////////////////////////////////////////////////////////////// // // (C) Copyright Ion Gaztanaga 2004-2026. 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 #include #include #include #include "print_container.hpp" #include "movable_int.hpp" #include "map_test.hpp" #include "emplace_test.hpp" ///////////////////////////////////////////////////////////////// // // This example repeats the same operations with std::map and // shmem_map using the node allocator // and compares the values of both containers // ///////////////////////////////////////////////////////////////// using namespace boost::interprocess; //Customize managed_shared_memory class typedef basic_managed_shared_memory , rbtree_best_fit, iset_index > my_managed_shared_memory; //Alias allocator type typedef allocator, my_managed_shared_memory::segment_manager> shmem_pair_allocator_t; typedef allocator, my_managed_shared_memory::segment_manager> shmem_movable_pair_allocator_t; typedef allocator, my_managed_shared_memory::segment_manager> shmem_move_copy_pair_allocator_t; //Alias map types typedef std::map MyStdMap; typedef std::multimap MyStdMultiMap; typedef boost::container::flat_map, shmem_pair_allocator_t> MyShmMap; typedef boost::container::flat_multimap, shmem_pair_allocator_t> MyShmMultiMap; typedef boost::container::flat_map ,shmem_movable_pair_allocator_t> MyMovableShmMap; typedef boost::container::flat_multimap ,shmem_movable_pair_allocator_t> MyMovableShmMultiMap; typedef boost::container::flat_map ,shmem_move_copy_pair_allocator_t> MyMoveCopyShmMap; typedef boost::container::flat_multimap ,shmem_move_copy_pair_allocator_t> MyMoveCopyShmMultiMap; int main() { using namespace boost::interprocess::test; if (0 != map_test()){ std::cout << "Error in map_test" << std::endl; return 1; } if (0 != map_test_copyable()){ std::cout << "Error in map_test" << std::endl; return 1; } //MSVC 14.5 (2026 ICEs when trying to compile move-only types in flat_map) #if defined(BOOST_MSVC) && (BOOST_MSVC == 1960) if (0 != map_test()){ return 1; } if (0 != map_test()){ std::cout << "Error in map_test" << std::endl; return 1; } if (0 != map_test()){ std::cout << "Error in set_test" << std::endl; return 1; } #endif return 0; }