<Though the subject line may be a bit misleading, bear with me a little>
I was reading up on pthread `s and then found out std::thread. It ...seems wonderful.
So, are the following versions of the snippet exactly equivalent?
Code:
class X
{
public:
std::string foo;
void operator()(){std::cout<<foo<<std::endl;}
};
int main()
{
X bar;
cin>>bar.foo;
thread t(bar);
t.join();
return 0;
}
Code:
void foo(std::string bar)
{
std::cout<<bar<<std::endl;
}
int main()
{
string bar;
cin>>bar;
thread t(bind(foo,bar));
t.join();
return 0;
}
Or is there some hidden difference I should know about ?
[Also, I remember seeing a thread here in which someone posted about a bug in gcc's implementation of std::thread. I can't find it now. Anyone remember what it was about?]