Boost logo

Boost :

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

Hi Oliver,

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

> > 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.


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.


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.



Boost list run by bdawes at, gregod at, cpdaniel at, john at