Boost logo

Boost Users :

From: BRIDGES Dick (Dick.Bridges_at_[hidden])
Date: 2005-08-29 13:38:56

The documentation gives examples for
  int operator()(int a, int b)...
  bool operator()(long a, long b)...
that use _1 to represent the first parameter (i.e., 'a').

I'm trying to pass a function object that takes no
parameters to a boost::thread constructor and cannot
get it right.

class Foo {
    operator()() { /* do something */ return; }

main( int argc, char **argv ) {

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

    return 0;

Isn't the '_1' required for the this pointer? If it's not
required, what is the correct form?

Thanks in advance for any help.

Dick Bridges

"Multithreading is just one damn thing after, before, or simultaneous
with another." Scott Meyers and Andrei Alexandrescu

Boost-users list run by williamkempf at, kalb at, bjorn.karlsson at, gregod at, wekempf at