31 Dec
2007
31 Dec
'07
2:49 p.m.
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