10 Sep
2009
10 Sep
'09
5:29 p.m.
Hi there, I am playing with lambda. This following code works: ------------------------------------- void test_thread(std::string s) { cout << "string is" << s << endl; } boost::thread enquiry_thread(test_thread, s ); ------------------------------------- but the lambda version does not compile. Why? Thanks. ------------------------------------- #include"boost/lambda/lambda.hpp" #include"boost/lambda/bind.hpp" using namespace boost::lambda; 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) );