
Richard Vock wrote:
The smallest change to your code I think would be this though. --- thread t( boost::bind( &Kernel::operator(), m_kernel[i] ) ); t.join();
I've always had problems understanding boost::bind, but this helps a lot.
And it works too...
Thank you!
I realise this solves your problem but didn't really answer your question though. The reason it doesn't work with an abstract class is because the thread class attempts to copy the functor you're passing in. Since Kernel is abstract you can't do this. If you make Kernel a concrete class you get a different problem. The statement: thread t( *(m_kernel[i]) ) slices the object down to a plain old Kernel, irrespective of what the pointer originally referenced. You can only call virtual functions through pointers or references so you lose dynamic binding once this happens. n