AMDG Daniel Veneros wrote:
Thanks,
I fixed some things and its running now. What I don't know how to do is to declarate/allocate a custom class.. I got this:
typedef managed_shared_memory::segment_manager SegmentManager;
typedef allocator
CharAllocator; typedef basic_string
BasicString; typedef allocator
IntAllocator; class Action { int id; BasicString task; public: Action(int num, const char *name, const VoidAllocator &void_alloc) :id(num), task(name,void_alloc) {} void setId(int num); void setTask(BasicString newTask); };
void Action::setId(int num) { id = num; }
void Action::setTask(BasicString newTask) { task = newTask; }
Now... how should I allocate the "Class" object?? Any Idea? Thanks!!
I assume that by Class you mean the Action class?
If this class is used at the top level, you can use
managed_shared_memory::construct. If you want
to use an allocator with it, the commands are
allocator