31 Dec
2005
31 Dec
'05
12:21 p.m.
David A. Greene wrote:
Sebastian Redl wrote:
David A. Greene wrote:
What's the best way to do this? typeof?
One option is boost::function, but that would require a bit of refactoring, most likely, and would impose a runtime overhead.
Can you explain how boost::function would help here?
Well, you didn't provide much details, but
template<typename F> class Callback { public: Callback(F func) ... }
template
class OneMoreArgCallback : public Callback { public: OneMoreArgCallback(F func, Arg arg) : Callback(boost::bind(func, arg, _1)) {}; }
depending on the contents of the ... in Callback, it might be possible to replace the whole Callback hierarchy with boost::function.