Boost logo

Boost Users :

Subject: [Boost-users] Making friend with boost::interprocess
From: Oncaphillis (oncaphillis_at_[hidden])
Date: 2009-03-11 03:57:56


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.


class Foo {
    static Foo & GetInstance() {
      try {
        void_allocator_t alloc(segment.get_segment_manager());
        return *(segment.find_or_construct<Foo>(

      } catch(std::exception & ex) {
     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


Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at