Dear everyone,
I've just begun learning to use IPC in boost. Here I want to create a
vector of vector, that is to say, a matrix of complex.
I read the section "containers of containers" in manual, and try to write
something as the following:
#include
#include
#include
#include <complex>
typedef boost::interprocess::allocator
ComplexAllocator;
typedef boost::interprocess::vector
ComplexVector;
typedef boost::interprocess::allocator
ComplexVectorAllocator;
typedef boost::interprocess::vector
ComplexMatrix;
int main ()
{
struct shm_remove
{
shm_remove() {
boost::interprocess::shared_memory_object::remove("MySharedMemory"); }
~shm_remove(){
boost::interprocess::shared_memory_object::remove("MySharedMemory"); }
} remover;
boost::interprocess::create_only_t tag;
boost::interprocess::managed_shared_memory segment(tag,
"MySharedMemory",
65536);
const ComplexVectorAllocator alloc_inst (segment.get_segment_manager());
ComplexMatrix *m =
segment.construct<ComplexMatrix>
("M")(alloc_inst);
m->resize(4);
segment.destroy<ComplexMatrix>("M");
return 0;
}
However, it could not compile. And the error message is too long for me to
understand. Is there anyone knowing how to fix this?
Best wishes,
Guoxi