#include "dll.h" class dq { public: typedef char item_type; dq(void) { return; } bool empty(void) { return list.begin() == list.end(); } item_type front(void) { return list.begin()->itm; } item_type back(void) { return list.end()->itm; } void push_front(const item_type c) { list.insert (list.begin(), c); } void push_back( const item_type c) { list.insert(list.end(), c); } item_type operator[] (unsigned int n) { return helper(n, list.begin()); } item_type helper(unsigned int n, dll::link * pos) { if (n == 0) return pos->itm; else return helper(n-1, list.succ(pos)); } private: item_type item; dll list; };