#ifndef LIST_CC #define LIST_CC #include "list.hh" template void List::OK() const { int i = size_; Link *lp = top_; while (i--) { assert(lp); lp->OK(); lp = lp->next(); } assert(!lp); i = size_; lp = bottom_; while (i--) { assert(lp); lp->OK(); lp = lp->previous(); } assert(!lp); } template Cursor List::top() { // ?? waarvoor is deze if ? if ( top_ ) // equivalent: if ( size_ ) { Link* t = top_->previous(); assert( t != top_ ); // silly link while ( t ) { assert(false); // this is even more silly. top_ = t; t = top_->previous(); } } // list empty: Cursor not ok() return Cursor( *this, top_ ); } template Cursor List::bottom() { /* wat is dit voor zooi? kan dit niet weg? (invarianten!) */ if ( bottom_ ) // equivalent: if ( size_ ) { Link* b = bottom_->next(); assert( b != bottom_ ); // silly link while ( b ) { bottom_ = b; b = bottom_->next(); } } // list empty: Cursor not ok() return Cursor( *this, bottom_ ); } // not inlined since it assumes knowledge of destructor. template inline void PointerList::remove( Cursor me ) { if ( me.ok() ) { delete *me; List::remove( me ); } } #endif