Boost logo

Boost Users :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2005-08-29 14:33:23


BRIDGES Dick wrote:

> class Foo {
> void
> operator()() { /* do something */ return; }
> }
>
> int
> main( int argc, char **argv ) {
>
> Foo f;
> boost::thread doit( boost:bind<void>(f,_1)() );
> doit.join();
>
> return 0;
> }
>
> Isn't the '_1' required for the this pointer? If it's not
> required, what is the correct form?

In this specific case you don't need boost::bind at all.

    boost::thread doit( f );

If you had

class Foo {
   void
   operator()( int x ) { /* do something with x */ return; }
}

then you'd need to use bind to supply a value for x:

    boost::thread doit( boost:bind<void>( f, 5 ) );


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net