On Fri, Oct 14, 2011 at 8:46 PM, Peter Dimov <pdimov@pdimov.com> wrote:
Robert Jones wrote:
...


void task( int );

vector<int> v;
v += 1,2,3,4,5,6,7,8,9;
pool my_pool;

for_each( v.begin( ), v.end( ), bind( schedule, my_pool, _1 ) );

The easiest solution would be for you to define

void my_schedule( pool & my_pool, int k )
{
  schedule( pool, boost::bind( task, k ) );
}

and then use my_schedule above (you'll need ref(my_pool) though.)

Or, you could bind &pool::schedule directly, without going via the schedule convenience wrapper:

  bind( &pool::schedule, &my_pool, protect( bind( task, _1 ) ) )


Hi Peter

Thanks for that - I very much prefer your second solution as it keeps it all very local, and thanks
also for deciphering my gibberish which did of course completely fail to mention 'task()'!

- Rob.