I would like to know if it is possible to inherit from boost :: function.
Basically, for ease of use, what I would like to have is the "Delegate" type, which is basically a boost :: function. This is just for ease of use in some code that I am writing.
I am at some point typedef'd boost :: function to Delegate, but typedef'ing in my experience is playing hell with gdb. Especially if it was modified, so I wanted to avoid this (ever trying to debug stl containers that were typed? Oofta).
I found code on the Internet that gave an example:
template<class Signature> class Delegate : public boost::function<Signature> { public: using boost::function<Signature>::operator(); };
Now when I try to use it, I get some errors. Usage example:
Tank * tankptr = new Tank(); Delegate<void ()> tankShoot(boost::bind(boost::mem_fn(&Tank::Shoot),tankptr));
It gives errors like
error: no matching function for call to 'Delegate<void ()()>::Delegate(boost::_bi::bind_t<boost::_bi::unspecified, boost::_mfi::mf0<void, Tank>, boost::_bi::list1<boost::_bi::value<Tank*> > >)' Delegate.h:26: note: candidates are: Delegate<void ()()>::Delegate() Delegate.h:26: note: Delegate<void ()()>::Delegate(const Delegate<void()()>&)
If I had to guess why I get these errors, I have to say that it is not, some kind of copy constructor that accepts any base that the boost :: bind constructor returns.
Any thoughts on how I can overcome this obstacle, or anyone who can point me to good examples of inheritance from boost :: function?
source share