Boost logo

Boost :

From: Eyal Farago (eyalfa_at_[hidden])
Date: 2002-04-07 12:25:40


Which is the latest version of shred_ptr? I ahve boost 1.27.0 on my
machine.
the following code did not compile:

//main.cpp
#include <boost\smart_ptr.hpp>

class my_class;

void main()
{
        boost::shared_ptr<my_class> sp_my_class;
}

the error message:
c:\boost_1_27_0\boost\checked_delete.hpp(26) : error C2027: use of
undefined type 'my_class'

-the file and line leads to boost::checked_delete()

When doing the same thing with other 'smart' classes msvc6 usually gives
a warning about deletion of incomplete type...

Eyal.

-----Original Message-----
From: Peter Dimov [mailto:pdimov_at_[hidden]]
Sent: Sunday, April 07, 2002 5:11 PM
To: boost_at_[hidden]
Subject: Re: [boost] Circular dependencies and smart pointers

From: "Eyal Farago" <eyalfa_at_[hidden]>
> 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.

This is no longer necessary if you are using the latest shared_ptr (but
is
still the case with scoped_ptr.) If shared_ptr doesn't work with
incomplete
types then this is a bug (either in shared_ptr or in the compiler ;-) )

_______________________________________________
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