
Hi, I would like to get some feedback on some changes that I would like to make to boost::function for my own use only and I figured that this would be the best place for it. I basically want to detect if there is a NULL "this" bound to a member function. I want to do this so that i can prevent dereferencing a NULL pointer when calling a member function. I hope the following code example will clarify. /////////////////////////////////////////////////////////////////////// // example code: /////////////////////////////////////////////////////////////////////// struct X { void f() { assert(this != NULL); } }; my_smart_ptr<X> sp_x = new X(); my_weak_ptr<X> wp_x = sp_x; boost::function0<void> _f = bind(&X::f,wp_x); assert(!_f.empty()); sp_x.reset(); // wp_x == NULL if(!_f.empty()) { _f(); // This will fail } //////////////////////////////////////////////////////////////////////// I can't use exceptions because the code size would be too great on my embedded arm platform. Therefore I would like to have a member of boost::function that would tell me if i could call the function. I was thinking empty() but that may not be a good choice. I am just looking for a little guidance and also any general feedback. Thanks -- Theodore Witkamp CTO RiffWare LLC 107 S Holliston Ave Apt 308 Pasadena, CA 91106 Mb. 626-372-0931