Boost logo

Boost Users :

From: Michael Bradley Jr (mbradley.jr_at_[hidden])
Date: 2007-12-31 09:49:19


Hi,

i do have the following situation

3 independent classes A, B and C with the following requirements:

1.

class A {
private:
        A(int);
        ~A();

        class deleter_t{
        public:
        void operator()(A* p) { delete p; }
        };
        friend class deleter_t;
        
public:
        shared_ptr<A> create(int i) {
        return boost::shared_ptr<A>(new A(i),deleter_t());
        }
};

class B {
        boost::shared<A> obj_;
};

class C {
        boost::shared_ptr<B> b_;
        boost::shared_ptr<A> a_;
};

2.
Class C instantiates A and gets a boost::shared_ptr<A> through A::create
Class B just need a boost::shared_ptr<A>.

3.
C first release B and then A

Now my question how can i achieve that goal, when A MUST obey to the singleton
pattern?

Thanks in advance for any help

Cheers
Michael


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net