|
Boost Users : |
From: Vladimir Krasovsky (vkrasovsky_at_[hidden])
Date: 2005-05-18 10:10:19
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_at_[hidden]
Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net