class queue{
struct element{
void* data;
element* next;
}
element* head;
element* tail;
this(){
head = null;
tail = null;
}
void push(void* data){
element* e = new element;
e.next = null;
if(tail){
tail.next = e;
} else {
head = e;
}
}
void* pop(){
element *ret = head;
if(head){
head = head.next;
}
return ret;
}
}Add a code snippet to your website: www.paste.org