How to bind the lifetime of a shared resource object to the union of its users' lifetimes?
<p>I have a number of GUI widgets that all make use of the same shared timer object. I would like to have the first GUI object that comes into existence create the timer instance and later have the last remaining gui object take care of destroying the timer.</p>

<p>Is there an idiomatic C++ solution for this kind of problem?</p>

<h3>Update</h3>

<p><a href="http://ideone.com/UMLvt" rel="nofollow">Here is an attempt at a more generic solution.</a></p>
