From b855841abe5456f3bdcecd00d149cc55eebef3fd Mon Sep 17 00:00:00 2001 From: fred Date: Fri, 1 Nov 1996 13:18:04 +0000 Subject: [PATCH] flower-1.0.4 --- flower/list.cc | 31 +++++++++++++------------------ flower/list.inl | 44 ++++++++------------------------------------ 2 files changed, 21 insertions(+), 54 deletions(-) diff --git a/flower/list.cc b/flower/list.cc index 782b3da86e..741e4ee97c 100644 --- a/flower/list.cc +++ b/flower/list.cc @@ -3,6 +3,15 @@ #include "list.hh" +template +List::List(List const&src) +{ + set_empty(); + // probably el stupido + for (Cursor c(src); c.ok(); c++) + bottom().add(c); +} + template void List::OK() const @@ -29,7 +38,7 @@ template Cursor List::top() { - +#if 0 // ?? waarvoor is deze if ? if ( top_ ) // equivalent: if ( size_ ) { @@ -42,7 +51,9 @@ List::top() t = top_->previous(); } } - // list empty: Cursor not ok() +#endif + +// list empty: Cursor not ok() return Cursor( *this, top_ ); } @@ -70,20 +81,4 @@ List::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 diff --git a/flower/list.inl b/flower/list.inl index 8396156b6a..8bdcf15877 100644 --- a/flower/list.inl +++ b/flower/list.inl @@ -4,6 +4,13 @@ template inline List::List() +{ + set_empty(); +} + +template +inline void +List::set_empty() { top_ = bottom_ = 0; size_ = 0; @@ -13,8 +20,7 @@ template inline List::List( const T& thing ) { - top_ = bottom_ = 0; - size_ = 0; + set_empty(); add( thing, Cursor( *this, bottom_ ) ); } @@ -113,40 +119,6 @@ List::size() const return size_; } -template -inline -PointerList::PointerList() : - List() -{ -} - -template -inline -PointerList::PointerList( const T& thing ) : - List( thing ) -{ -} - -template -inline -PointerList::~PointerList() -{ - Cursor next(*this); - for ( Cursor c( *this ); c.ok(); c = next ) { - next = c; - next++; - remove( c ); // PointerList::remove deletes the real data - } -} - -template -inline void -PointerList_print( PointerList const & l ) -{ - List& promises_to_be_const = (List&) l; - for ( Cursor c( promises_to_be_const ); c.ok(); c++ ) - (*c)->print(); -} #endif -- 2.39.5