Making friend with boost::interprocess

Hi, I'd like to implement a cross-process singleton which resides in a shared memory segment. So the basic idea is to provide a factory method that is the only way to construct the Singleton. e.g. class Foo { public: static Foo & GetInstance() { try { boost::interprocess::managed_shared_memory segment( boost::interprocess::open_or_create, "FooSegment", 65536); void_allocator_t alloc(segment.get_segment_manager()); return *(segment.find_or_construct<Foo>( "FooObject")(alloc)); } catch(std::exception & ex) { throw; } } private: Foo(const void_allocator_t & a) { ... ... } Foo(const Foo &); } Of course somewhere deep in the guts of boost I get an error since the Foo constructor is private. Who do I have to befriend in order to make this scheme work ? Thank you O.
participants (1)
-
Oncaphillis