Boost logo

Boost :

Subject: Re: [boost] Question about futures library that was written by Anthony Williams
From: Anthony Williams (anthony.ajw_at_[hidden])
Date: 2009-03-11 04:59:10


"Jon Shuler" <JShuler_at_[hidden]> writes:

> There is an example in the documentation under Creating Asynchronous
> Values that shows how to call a function. Is it possible to call a
> member function that has arguments?

Not directly. You have to use boost::bind to wrap the member function
call:

packaged_task t(boost::bind(&X::foo,&some_x,arg1,arg2));

Anthony

-- 
Author of C++ Concurrency in Action | http://www.manning.com/williams
just::thread C++0x thread library   | http://www.stdthread.co.uk
Just Software Solutions Ltd         | http://www.justsoftwaresolutions.co.uk
15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976

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