scoped_ptr, shared_ptr and pimpl
I have an object that uses scoped_ptr to point to it's impl...an incomplete type forward declared in the header and implemented in the cpp file. This object *does have a user defined destructor*! This user defined destructor is defined after the opaque type has been fully defined in the same cpp file. In another cpp file I have a function that lives in the same namespace as the object in question, which creates a shared_ptr to this object. I'm getting the "undefined type" error in checked_delete for the impl object. I've run into this problem before but it was because I did not have a user defined destructor for the outer object...now I do. I even created a blank destructor for the impl, something I've never had to do before. What gives? Any ideas where to look for the problem? My simplest program that exhibits the problem doesn't exhibit the problem...I find this frustrating.
Noah Roberts wrote:
I have an object that uses scoped_ptr to point to it's impl...an incomplete type forward declared in the header and implemented in the cpp file.
This object *does have a user defined destructor*! This user defined destructor is defined after the opaque type has been fully defined in the same cpp file.
Try adding an out of line _constructor_ as well. If this doesn't help, post code.
I solved my problem. I had a rogue constructor body in the header. I had disabled the copy constructor but given it a blank body.
participants (2)
-
Noah Roberts
-
Peter Dimov