Boost logo

Boost Users :

Subject: [Boost-users] boost interval container in shared memory
From: Asna Ishrat (asnaishrat_at_[hidden])
Date: 2015-10-13 10:29:07


I have been trying to store boost interval map in shared memory, but my
code below does not compile when I pass allocator while constructing map.
After seeing template definition of boost interval_map I assume that boost
icl only supports std::allocator. Is there any way to store this container
in shared memory.

int main () {
        static bip::managed_shared_memory
global_mm(boost::interprocess::open_or_create,
"MySharedMemory",65536 //segment name
);
 static bip::allocator<void, bip::managed_shared_memory::segment_manager>
global_alloc(global_mm.get_segment_manager());

boost::icl::interval_map<int, int> *party =
global_mm.find_or_construct<boost::icl::interval_map<int,
int>>("Store")(global_alloc);
party->add(make_pair(boost::icl::interval<int>::right_open(4,5),1));

std::cout << "adding result: " << *party << "\n";
}



Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net