Boost logo

Boost :

From: Dietmar Kuehl (dietmar_kuehl_at_[hidden])
Date: 2000-05-06 13:42:34


Hi,

> >I assume you have a class directory_iterator which contains a
> >boost::shared_ptr member. All you should have to do is write an
> >out-of-line destructor for directory_iterator, which gets declared
> >in a source (not a header) file.

... and an assignment operator because the assignment operator might
release the internal pointer, too. Anyway, thinking that a library
should never produce a warning, not even if obscure warnings are turned
on, this means for gcc to also implement the copy constructor (if
-Weffc++ is turned on, the compiler warns for a class which defines
a copy ctor, a copy assignment, or a dtor but not all three methods).

None of these methods is particularily complex: copy or a assigning a
pointer isn't that hard and the destrutor can even be empty. Still, I
would prefer to write no extra code at all: While it isn't the case for
the directory iterator, in general the out of line function definition
isn't that nice because you need to write down all this template header
and such.

> Cool! Why didn't I think of that?

... but if everybody agrees that this is the way to go, I will take it,
too. After all, C++ is quite verbose at times anyway.

Regards,
 dk

=====
<mailto:dietmar_kuehl_at_[hidden]>
<http://www.dietmar-kuehl.de/>

__________________________________________________
Do You Yahoo!?
Send instant messages & get email alerts with Yahoo! Messenger.
http://im.yahoo.com/


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