|
Boost Users : |
Subject: Re: [Boost-users] [shared_ptr] Member functions as deallocators
From: Igor R (boost.lists_at_[hidden])
Date: 2009-06-03 10:11:22
> 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));
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net