Hello Filipe, Tuesday, May 17, 2005, 5:46:27 PM, you wrote:
Hi!
I'm having trouble implementing Pimpl idiom with Qt.
If I remove Q_OBJECT macro or add a destructor the code compiles fine. I don't have a problem with shared_ptr, only with scoped_ptr.
If you wish to use scoped_ptr as a pointer to implementation you should always define (in .cpp file) destructor for outer class even if it is empty destructor. This allows compiler to generate (instantiate) proper destructor for shared_ptr<YourImplementationClass>. Otherwise it instantiates such destructor in scope where YourImplementationClass is incomplete and you receive said errors. It is normal common practice to define empty constructor in such cases. shared_ptr does not have problem like this, but it is more "heavyweight". -- Best regards, Vladimir mailto:vkrasovsky@yandex.ru