Boost logo

Boost :

From: Jonathan Wakely (cow_at_[hidden])
Date: 2005-08-17 09:08:57


Martin Bonner wrote:

> From: Jonathan Wakely
> > clone_ptr also needs the definitions of all derived classes to be
> > visible, whereas something like ptr_container that uses a clone()
> > member function only needs to see the definition of the base
> > class and can do everything through the base class' interface.
>
> I think it only needs the definition available for the constructor (which is
> where a class derived from his "copier" class is instantiated).
> [snip]
> > This would not be possible with std::vector<clone_ptr<Base> >:
[snip bad example]
> > The fill() function can now be implemented in another file and
> > populate the vector with any type derived from Base, without
> > recompiling pc.cc
>
> I think that is supported with clone_ptr. The file implementing fill would
> need the full definition of the derived type(s) of course, but that is less
> restrictive.

And to be expected ... yes, you're right. I might have had another
example in mind originally but can't think of it now. I remove my
objection!

jon


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