I no longer control the allocation of memory by the internal polyhedron of a function.
You really have control.
The reference guide says:
The Polygon_2 class implements polygons. Polygon_2 is parameterized by the traits class and container class. The last can be any class that meets the requirements of the STL container. By default, the vector class is used.
In addition to using a new location for the polygon itself, you need a container that can be placed in shared memory. You can try using boost::interprocess::vector or flip your own container class.
If you use boost::interprocess::vector , you need to create a wrapper class for it, because unlike the STL container, its constructor requires a distribution object. Polygon_2 will not be able to build it correctly. Thus, you will have to get the distributed memory allocation object from some global variable. For instance:
using namespace boost::interprocess; typedef allocator<int, managed_shared_memory::segment_manager> ShmemAllocator; ShmemAllocator some_global_shmem_allocator; template <typename T> class my_shared_memory_vector : vector<T, ShmemAllocator> { public: my_shared_memory_vector() : vector(some_global_shmem_allocator) {} };
Disclaimer: I actually did nothing myself. If your computer catches a flame as a result of this, and your house burns, do not hold me responsible. It would be wise to double-check (by looking at the GCAL source) that any Polygon_2 memory Polygon_2 is actually controlled by the container.
Edit : I misunderstood the question, he asks about polyhedrons, not about polygons. See Comment below.
source share