|
Boost : |
From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-07-10 06:13:21
From: "David B. Held" <dheld_at_[hidden]>
> "David Abrahams" <david.abrahams_at_[hidden]> wrote in message
> news:097901c2277f$8cb6df40$6601a8c0_at_boostconsulting.com...
> > [...]
> > Wouldn't a syntax like:
> >
> > invoke(target, pmf, arg1, arg2...)
> > [...]
>
> Yeah, I like that syntax, and I see that it spares you the intermediate
> closure object. I could write invoke() myself for a few cases, but I
> don't understand the preprocessor lib enough to make it generic
> for arbitrary numbers of parameters. Of course, people will still
> argue that you should just use bind(), and maybe they're right. ;)
Actually I think that (p.get()->*pmf)(a1, ...) is the best solution. Adding
the syntactic sugar to shared_ptr would be nice (following the design goal
"as close as possible to raw pointers") but, on the other hand, I tend to
avoid additional complexity unless the benefits clearly outweigh the cost.
As we learned from mem_fn, implementing such a feature reliably (__stdcall,
__fastcall, MSVC 6 with its ICEs, Sun CC with its parser errors, HP aCC with
I-don't-remember-what-anymore) is a lot of work. :-)
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk