From: Todd Greer (tgreer_at_[hidden])
Date: 2000-03-30 17:17:39
Thomas Matelich <tmatelich_at_[hidden]> writes:
> This probably applies to all of the smart pointers, I just haven't used
> them. My problem is that I'm replacing some dumb pointers with
> shared_ptr and now, I can't use forward references in my headers. Well,
> I can as long as every class used with shared_ptrs is included in every
> C file that includes the shared_ptr, in which case I might as will
> include the header rather than forward declare.
> The error involves deletion of incomplete type. Oops just noticed that
> its a warning. In any case, I would like to avoid the warning. What
> have other people done with regards to this?
Define your dtor out-of-line in the C file, where the type is
complete. An empty dtor is fine. This will cause the dtor of the
smart pointer to be instantiated there, so it will see the complete
type. This will be necessary for any normal variety of smart
pointer--some will need copying to be defined out-of-line also.
-- Todd Greer <tgreer_at_[hidden]>
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk