title: std::unordered_map with shared pointer for auto destruction of entries
body: <p>I have an <code>unordered_map&lt;int, custom_object* &gt;</code> and have various shared pointers pointing to every entry in the <code>unordered_map</code>. The idea is so that once all the shared pointers are destructed, the entry will be removed from the <code>unordered_map</code>. <code>custom_object</code> currently contains the key so that it can remove the respective entry from the <code>unordered_map</code> upon destruction. I'd like to have a more elegant design, perhaps implementing an <code>unordered_map&lt;int, shared_ptr&lt;custom_object&gt;&gt;</code> instead. Any thoughts on this?</p>