[comp.lang.c++] implementation question libg++ List.ccP

tpf@jdyx.UUCP (Tom Friedel) (08/27/89)

I am using g++ and the List.hP, List.ccP LISP List prototypes in
libg++.

I would like to have a list of arbitratry structures.  SInce a structure
might be in several lists, I believe that I want lists of pointers to
these arbitrary structures.

A libg++ List node looks like  (with arbirtary user-defined type Q)

struct QListNode
{
  QListNode*          tl;
  short                 ref;
  Q                   hd;
};

The type Q must be defined so that I can overload the == operator.
This is a requirement of libg++ as well as my application.

How would I implement type Q and the arbitrary structure, and do I
generate the class List by value or reference?

What I did was define a 
   struct X { ------ }  ;   // my arbitrary structure 
and defined Q as 
   typedef X * Q ;
and built List.ccP by reference.

This compiles and runs O.K.,

but now need to define an == operator for Q, and don't really know
how, and suspect that I have implemented things wrong.


Thanks for any help,

Tom


-- 
Tom Friedel             Public Access Unix BBS
tpf@prism.gatech.edu    ...gatech!emory!jdyx!tpf          
(404) 320-7624          (404) 321-5020