10 Sep
2009
10 Sep
'09
8:24 p.m.
Boost lzw wrote: [snip]
but the lambda version does not compile. Why? Thanks. -------------------------------------
void test_thread(std::string s) { cout << "string is" << s << endl; }
std::string s("I am a string"); boost::thread inquiry_thread(bind(test_thread, _1)(s) );
bind(test_thread, _1) creates a functor expecting one argument. Appending "(s)" right after invokes that functor, passing it s as an argument. What you want is: bind(&test_thread, s)