Boost logo

Boost Users :

Subject: [Boost-users] [lambda] for thread bind
From: Boost lzw (boostlzw_at_[hidden])
Date: 2009-09-10 13:29:49


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) );



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