"Asger K. Alstrup Nielsen" wrote:
> 
> > > Also, I would suggest that all classes be made assignable such
> > > that memory management is simplified. There is no reason that the
> > > user of this library has to fiddle with new and delete.
> >
> > Could you elaborate on this.
> 
> Every class should define these methods:

> I.e. if a class is assignable, it behaves much like POD, plain old data.

Ah, but that does not work so well when the exact type of the object is
not known at compile time as will be the case for most of these
objects.  I could of course provide proxy classed but that complicates
matters.

In my Aspell library I use a adapter class known as a ClonePtr to get
around this problem.  Basically it acts like a pointer but when ever one
ClonePtr gets assigned to another a copy is made using the clone
method.  When the ClonePtr gets destroyed so does the object its
pointing to.

-- 
Kevin Atkinson
[EMAIL PROTECTED]
http://metalab.unc.edu/kevina/

Reply via email to