boost::interprocess -- How do I construct a anonymous object ?

Hi, I'm using boost::interprocess (1.37) and would like to construct a couple of anonymous objects. The idea is to construct a named object via Object *o segment.find_or_construct<Object>("theObject")(); and let this one dynamically construct a couple of other objects to which it holds offset_ptrs. On destruction one could simply use segment.destroy_ptr<Object2>( myOffset.get() ); to get rid of these objects. This works fine with objects I constructed with segment.construct<Object2>("GAGA NAME")(); but the reference by name seems to be unnecessary. The doc tells something about constructing and creating of anonymous objects but so far I only find allocators or copy constructors for anonymous objects. Thanks you .... O.

Oncaphillis wrote:
Hi,
I'm using boost::interprocess (1.37) and would like to construct a couple of anonymous objects. The idea is to construct a named object via
Object *o segment.find_or_construct<Object>("theObject")();
http://www.boost.org/doc/libs/1_38_0/doc/html/interprocess/managed_memory_se... **************************** using namespace boost::interprocess; MyType *ptr = managed_memory_segment.construct<MyType>(anonymous_instance) (par1, par2...); //Other construct variants can also be used //(including non-throwing ones) //We can only destroy the anonymous object via pointer managed_memory_segment.destroy_ptr(ptr); **************************** Best, Ion
participants (2)
-
Ion Gaztañaga
-
Oncaphillis