void push_front(const T & dat) { node *newdat = new node(&mFront, new T(dat), mFront.forward()); mFront.forward()->backward(newdat); mFront.forward(newdat); ++mSize; }
template < typename...Args > void emplace_front(Args && ... args) { node *newdat = new node(&mFront, new T(args...), mFront.forward()); mFront.forward()->backward(newdat); mFront.forward(newdat); ++mSize; }
void pop_front() { if (mSize == 0) return; node *current = mFront.forward(); current->forward()->backward(&mFront); mFront.forward(current->forward()); delete current->data(); delete current; --mSize; }
bool empty() const { return !mFront.forward()->usable(); }
node(const node & obj):mFront(obj.forward()), mBack(obj.backward()), mDat(obj.data()) { }
iterator begin() { return iterator(mFront.forward()); }
T & front() { if(!mFront.forward()->usable()) throw cov::error("E0005"); return *mFront.forward()->data(); }