3 Jun
2009
3 Jun
'09
2:11 p.m.
I'm using shared_ptr to hold a SceneManager object. In this particular case, I don't actually want the shared_ptr to have ownership of the SceneManager, but rather take advantage of it to insure that the SceneManager it holds is cleared when the containing object (a game's state) is destroyed. The deallocator needs to call SceneManager::clearScene, but it needs to call it on the held object, so the deallocator call would be essentially (pointer held in shared_ptr)->clearScene( ); Can anyone give me some guidance on how to accomplish this?
boost::shared_ptr<SceneManager > sceneManager(new SceneManager, boost::bind(&SceneManager::clearScene, _1));