|
Boost : |
From: Gavin Collings (gcollings_at_[hidden])
Date: 2000-03-21 07:53:11
"miki jovanovic" <mik-_at_[hidden]> wrote:
original article:http://www.egroups.com/group/boost/?start=2704
>
> Since linked_ptr must inherit publicly from linked_ptr_base, this in
> theory means that the user can get the pointer to the linked_ptr_base,
> and then try to destroy it. Effect of this would be a GPF or resource
> leak. To stop the user from doig this, linked_ptr_base destructor
> should be protected, and since it does nothing, it is empty.
That seems to take care of it, but is there a good reason why this
inheritance relationship is public? For compilers that support member
template friends a fix like the following could be used.
#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
class linked_ptr : private linked_ptr_base {
#else
class linked_ptr : public linked_ptr_base {
#endif
...
#ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
template <typename U> friend class linked_ptr;
#endif
In fact the entire class could do with having the member template
macros applied. If no-one objects, I'll make the changes to the
docvault version.
Gavin
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk