//
// genq5.cpp - generic queue of void *
// with an iterator class
//
#include "genq5.h"
void *gneq::iterator::next()
{
void *pv = 0;
if (pc != 0)
{
pv = pc->element;
pc = pc->next;
}
return pv;
}
void genq::append(void *e)
{
cell *p = new cell(e, 0);
if (first == 0)
first = p;
else
last->next = p;
last = p;
}
int genq::remove(void *&e)
{
if (first == 0)
return 0;
cell *p = first;
if ((first = first->next ==0)
last = 0;
e = p->element;
delete p;
return 1;
}
//End of File