|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2001-05-04 07:19:11
From: "Jesse Jones" <jesjones_at_[hidden]>
> At 5:21 PM +0300 5/3/01, Peter Dimov wrote:
> >From: "Jesse Jones" <jesjones_at_[hidden]>
> >
> >> 2) The API is a bit more awkward than I would like. For example, I
> >> have lots of code that looks sort of like this:
> >>
> >> // About
> > > function<void> action(this, &CApp::DoAbout);
> >> handler->RegisterCommand(kAboutCmd, action, kDisabledIfDialog);
> >
> >[...]
> >
> >Doesn't bind.hpp that I recently posted solve these problems?
>
> Sure, but most people will use member function pointers very heavily.
> It doesn't seem reasonable to require them to drag in binders for
> such a common operation...
button.onClick = function<void>(this, &CApp::DoAbout);
vs
button.onClick = bind(this, &CApp::DoAbout);
Likewise,
handler->RegisterCommand(kAboutCmd, function<void>(this, &CApp::DoAbout));
vs.
handler->RegisterCommand(kAboutCmd, bind(this, &CApp::DoAbout));
In either case, you have to "drag in" binders. Whether you spell the binder
name "bind" or "function<void>" doesn't affect the code - except that if you
require 'function' to have bind functionality it will have to either drag in
bind.hpp, even if you don't bind anything, or duplicate the bind code.
[Don't CC me, please. :-)]
-- Peter Dimov Multi Media Ltd.
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk