callback to be called before any objects with automatic storage duration are destroyed
<p>Does there exist a standard (any C++ standard) way to register a callback, that gets called shortly before any objects with automatic storage duration are destroyed as part of normal program termination?</p>

<p>EDIT:</p>

<p>To make this more clear. It's a multi-threaded application. Some objects may have pushed functors into a thread pool, that reference them (functor accesses the "originator" object). The thread pool object is static, so it gets destroyed <strong>after</strong> <code>main()</code> returns and so after all these objects who pushed functors into the thread pool, that are referencing them, have already been destroyed. The thread pool is flushed upon termination and so the functors have dangling references to "originator" objects in them.</p>