Boost logo

Boost :

From: Peter Dimov (pdimov_at_[hidden])
Date: 2002-04-07 08:36:02


From: "Christian Kreibich" <kreibich_at_[hidden]>
> 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?

The latest version of shared_ptr (in the CVS) seems to work.


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk