Listing 1 Class definition for a generic queue using void * elements and a two-argument iteration function

//
// genq4.h - generic queue of void *
// with a two-argument iteration function
//

#include <iostream.h>

class genq
       {
public:
       genq( );
       void append(void *e);
       void apply(void f(void *e, void *a), void *args);
       int remove(void *&e);
private:
       struct cell
              {
              cell(void *e, cell *p);
              cell *next;
              void *element;
              };
       cell *first, *last;
       };

inline genq::cell::cell(void *e, cell *p)
       : element(e), next(p)
       {
       }

inline genq::genq() : first(0), last(0)
       {
       }

/* End of File */