Original Post
I'm trying to compile something like this: I have this simplified class and the real class in the same project. The simplified class compiles just fine, yet the real one gives me:
class ThreadedClass
{
public:
boost::thread *this_thread;
ThreadedClass();
~ThreadedClass();
void operator ()();
}
ThreadedClass::ThreadedClass()
{
this_thread = new boost::thread(*this);
}
ThreadedClass::~ThreadedClass()
{
if (this_thread) delete this_thread;
}
void ThreadedClass::operator ()()
{
std::cout << "void ThreadedClass::operator ()()!";
std::cout << std::endl;
}
c:\some\folder\someproject\somesourcefile.cpp(36) : error C2664: 'boost::thread::thread(const boost::function0<R> &)' :
cannot convert parameter 1 from 'Namespace::RealClass' to 'const boost::function0<R> &'
with
[
R=void
]
and
[
R=void
]
Reason: cannot convert from 'Namespace::RealClass' to 'const boost::function0<R>'
with
[
R=void
]
No constructor could take the source type, or constructor overload resolution was ambiguous
What is wrong? Also I can't even do this:
typedef void (*ThreadFunction)();
ThreadFunction = *this;
I'm compiling under MSVC++ .net Toolkit 2003 with MSVC++ .net 2003 SE headers & libraries. Edit: line split for ease.