I've observed a difference in behavior between the new library in Visual Studio 11 Beta and Boost with thread() and ref(). I'm wondering who is right. It could be both if the standard deviated from Boost's original implementation. (But I'm not about to try to decipher standardese...)
I would've tried it with MinGW... Alas, AFAIK, <thread> doesn't work for MinGW.
So, first question is, do gcc and Clang exhibit the same compilation failure? If they don't, I'll file a bug against VS. The second question might be, if that compilation failure is correct, what's my workaround to get what Boost gave me (short of keep using Boost)?
And I suppose I do have have a third question... Is what I'm doing even kosher to begin with?
class base
{
public:
virtual void operator()() = 0;
};
class derived : public base
{
public:
virtual void operator()()
{
cout << "derived" << endl;
}
};
int main()
{
base *b = new derived;
std::thread t(std::ref(*b)); // Nasty compilation errors.
boost::thread t(boost::ref(*b)); // Works fine.
t.join();
return 0;
}