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

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


Author of C++ Concurrency in Action |
just::thread C++0x thread library   |
Just Software Solutions Ltd         |
15 Carrallack Mews, St Just, Cornwall, TR19 7UL, UK. Company No. 5478976

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