[Prev][Next][Index]

yet another problem w/collections



> Forwarded message:
> > Date: Thu, 2 Feb 95 16:37:33 -0800
> > From: Nate Bernstein <nate@skinner.cs.uoregon.edu>
> > To: mohr
> > Subject: yet another problem w/collections
> > 
> > I'm having a problem with Collection method functions that are NOT inline.
> > 
> > method functions that are not declared inline don't seem to be able to access
> >  member fields of the Element class.
> > 
> > I think I can get around this by using:
> >  (Blob *)this->member_field;
> > 
> > where Blob is the type of the Element class, but this will cause a problem
> >  if I define a collection with a different class of Element.
> > It does not work to use:
> >  (ElementType *)this->member_field;
> > because functions that are not inline don't seem to know what ElementType is.
> > 
> > I've been trying stuff like:
> >  ((((CreatureList<ElementType> *)ThisCollection)->ElementType *)this)->member;
> > 
> > where CreatureList is the Collection name,
> > but so far, no luck with this mess...
> > 
> > 
> > I would just declare all of the functions inline, except that 
> >  ThisCollection does not work inline.  I think this is because, during
> >  compilation of this point in the code, the Collection definition is 
> >  incomplete, and so the ThisCollection pointer is not well defined...
> > 
> > 
> > --nate
> 
> -- 
> Bernd Mohr   --   mohr@cs.uoregon.edu   --  http://www.cs.uoregon.edu/~mohr
> 
> Sometimes I think the surest sign that intelligent life exists elsewhere in
> the universe is that none of it has tried to contact us.          -- Calvin
> 
> 

Could you send your code?  It is not clear what you are trying to do.

Shelby