Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-12-31 07:21:25


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<typename F, typename Arg>
> class OneMoreArgCallback : public Callback<SOME_BIND_TYPE> {
> 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.


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