
3 Jun
2009
3 Jun
'09
5:28 p.m.
Actually, using Boost.Bind will use a lot more memory overall. Would it not be better to create a static function somewhere, something like: class SceneManager { ... static deallocSM(SceneManage *ptr) { ptr->clearScene(); } ... }; And create as: SceneManager *s=fromSomewhere(); boost::shared_ptr<SceneManager> p(s, &SceneManager::deallocSM); Doing this means it only keeps a pointer to the function call, instead of through a bind instantiation, meaning this will execute ever so tiny slightly faster, as well as take less space? It has been a while since I created a new handler like that, but I 'think' the function takes a pointer to the embedded pointer type, check the smart_ptr docs for details I guess.