Boost logo

Boost :

From: Gavin Collings (gcollings_at_[hidden])
Date: 2000-03-21 07:53:11

"miki jovanovic" <mik-_at_[hidden]> wrote:
original article:
> 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.

class linked_ptr : private linked_ptr_base {
class linked_ptr : public linked_ptr_base {
   template <typename U> friend class linked_ptr;

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.


Boost list run by bdawes at, gregod at, cpdaniel at, john at