|
Boost : |
From: Eyal Farago (eyalfa_at_[hidden])
Date: 2002-04-07 11:02:52
I believe that this problem can be solved by explicitly defining non
inlined destructors to your classes, and implementing them in cpp files
that includes the full class definitions.
I had a similar problem when I used smar pointers to incomplete types in
my classes, what actually happens is that since the d'tor is inlined or
defined implicitly ,its 'code' is generated in the first cpp that
includes it, and then you get the compiler warning 'deletion of
incomplete type...' that boost's checked_delete transforms into a
compile time error.
Eyal
-----Original Message-----
From: Christian Kreibich [mailto:kreibich_at_[hidden]]
Sent: Sunday, April 07, 2002 3:03 PM
To: boost_at_[hidden]
Subject: Re: [boost] Circular dependencies and smart pointers
Peter Dimov wrote:
>
> This problem is not shared_ptr-specific; it usually comes up with
containers
> and iterators. The solution (within the current language) is to define
the
> types outside the class:
>
> class A;
> typedef boost::shared_ptr<A> A_ptr;
> class A
> {
> public:
> typedef A_ptr ptr;
> };
>
> You can still keep the A::ptr notation, but now you can break circular
> dependencies by using the global A_ptr alias.
Mhmm ... thanks Peter, I had already tried this, and get the following
result using g++ (2.95.4):
boost/checked_delete.hpp:26: `sizeof' applied to incomplete type `A'
boost/checked_delete.hpp:27: invalid use of undefined type `class A'
That's when I gave up :) Am I missing something?
Best regards,
Christian
-- ________________________________________________________________________ http://www.whoop.org _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk