|
Boost Users : |
From: electricsnark (CGLeggett_at_[hidden])
Date: 2002-11-13 18:10:21
I need to make a registry of callback functions, which are in
the form of member functions of objects of various types.
----------- code snippet -----------
class T1 {
public:
void CallBackFcn();
};
...
class Registry {
public:
template <typename T>
void registerFcn (void (T::*updFcn)(), T* obj );
private:
vector< boost::function<void>* > fcnvec;
};
template <typename T>
void Registry::registerFcn(void (T::*updFcn)(), T* obj) {
boost::function<void> *fp = new boost::function<void> (
boost::bind(updFcn,obj) );
fcnvec.push_back( fp );
}
main() {
....
T1 *pt = new T1;
p_Registry->registerFcn(&T1::CallBackFcn, pt);
}
-----------------------------------------------------
However, before adding the boost::function to the vector, I want
to make sure that the callback function isn't already in there.
Unfortunately, I can't just look at value of the pointer fp - I
need to get to the address of the actual callback function that
is to be executed. But I can't figure out how to get there.
Any help appreciated.
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