views:

73

answers:

2

Hello, I'm using boost's singletons (boost::serialization::singleton). I have to control the queue of class destructings. One singleton consist of the object whicn uses object from second singleton. And I have to delete second singleton, before the first one. Can I do this?

p.s. please, don't say anything about singleton programming technique :)

A: 

If you can reference the second singleton from the first using boost::weak_ptr you may be able to do what you wish to here. The first would need to make sure the weak_ptr is still live before using the second singleton.

Steve Townsend