|
Boost : |
From: Douglas Gregor (gregod_at_[hidden])
Date: 2000-11-17 20:55:54
On Fri, 17 Nov 2000 17:33:50 -0800
Jesse Jones <jejones_at_[hidden]> wrote:
> >I think if the callbacks are to be purified to only deal with functors, that
> >a construct taking an object and a method would be a mistake. Instead, I
> >think a make_callback function would be best.
>
> Why is a make_callback function better than a template ctor?
We settle on the most generic form of a callback (a bridge to any functor), but
add a templated constructor for one specific implementation? This strikes me
as contradictory. A make_callback free function is at least separate from the
callback class, and more free to rely on other libraries (e.g., lambda).
Also, if we have a callback with several parameters and don't have a typedef for
the callback's type, it gets a little long:
callback<float, int, int, float> myCallback;
// ...
MyClass c;
myCallback = callback<float, int, int, float>(&c, &MyClass::func);
Now that I think about it, I don't think either solution is necessary. If other
binding libraries are the intention, we might as well just let users use those
functions to create appropriate functors for member and free functions.
Doug Gregor
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk