#include <singletonpolicies.hpp>
Static Public Member Functions | |
| static void | onDeadReference () |
| static void | scheduleDelete (DelFunc kill_the_singleton) |
| implements the Singleton removal by calling the provided deleter function(s) at application shutdown, relying on the runtime system calling destructors of static objects. | |
Definition at line 92 of file singletonpolicies.hpp.
| static void lumiera::singleton::AutoDestroy< S >::scheduleDelete | ( | DelFunc | kill_the_singleton | ) | [inline, static] |
Because this Policy class can be shared between several Singletons, we need to memoize all registered deleter functions for calling them at shutdown.
Definition at line 101 of file singletonpolicies.hpp.
00102 { 00103 class DeleteTrigger 00104 { 00105 vector<DelFunc> dels_; 00106 00107 public: 00108 void schedule (DelFunc del) 00109 { 00110 dels_.push_back(del); 00111 } 00112 ~DeleteTrigger() 00113 { 00114 vector<DelFunc>::iterator i = dels_.begin(); 00115 for ( ; i != dels_.end(); ++i ) 00116 (*i)(); // invoke deleter func 00117 } 00118 }; 00119 00120 REQUIRE (kill_the_singleton); 00121 static DeleteTrigger finally; 00122 finally.schedule (kill_the_singleton); 00123 }
1.5.5