Boost logo

Boost :

From: Simon Meiklejohn (simon.meiklejohn_at_[hidden])
Date: 2006-08-16 18:43:26


Hi Oliver,

 <Oliver.Kowalke <at> qimonda.com> writes:
>
>
> > Do you have some code to do that?
> not yet (no time)
same

> > Is there scope for making defer_point::defer not only return
> > a future value, but also directly take parameters and
> > eliminate the slightly cumbersome bind steps?
> > e.g.
>
> Hmm - I'm defer function objects from member function of objects to
> defer_point.
> So I prefer the bind step.

I'm thinking it might be possible to extend defer to do the binding
within the defer request - so from callers perspective

a_deferpoint.defer( boost::bind( &some_class::some_member, param1, param2 ) );
is written as
a_deferpoint.defer( &some_class::some_member, param1, param2 );
where the latter invocation means effectively bind and defer execution.

Pro's

1. simpler for end users

2. if the defer object decides the call can be done immediately, then
possibly it can optimise out the bind step.

Cons

1. implementing as a template instance method on defer exposes
boost::bind to all clients of defer_point. (which tends to favour
a free function approach like
defer::bind_and_defer( a_deferpoint,&some_class::some_member, param1, param2 )
which can be in an optionally included header file.

2. More a question really - is it possible to write such a template function
(or group of function given variable number of parameters) that wraps
boost::bind and calls defer with the result.

Cheers

Simon


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk