|
Boost : |
From: scleary_at_[hidden]
Date: 2001-11-13 16:52:06
> The properties you describe are also very useful, but I do not understand
> how you can guarantee the last one; in my observations, the destruction
> order of objects in different modules have no guaranteed relation
Actually, the *construction* order has no guaranteed relation; the
destruction order is guaranteed to be the reverse of the construction order.
A user-defined object of static duration may "depend" on a singleton object
by calling singleton<T>::instance() somewhere in its constructor. This will
guarantee that the singleton will be constructed before the user-defined
object, and also guarantee that the singleton will be destroyed after the
user-defined object.
That is, by controlling when instance() is called, you can control (at least
to some degree) the construction order, and by implication the destruction
order.
-Steve
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk