$include_dir="/home/hyper-archives/boost-users/include"; include("$include_dir/msg-header.inc") ?>
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) );