14 List<T>::List( const T& thing )
18 add( thing, Cursor<T>( *this, bottom_ ) );
25 for ( Cursor<T> c( *this ); c.forward(); c++ )
31 List<T>::add( const T& thing, Cursor<T> after_me )
35 after_me.pointer()->add( thing );
37 bottom().pointer()->add( thing );
39 bottom_ = top_ = new Link<T>( thing );
42 if (!size_) { // not much choice if list is empty
43 bottom_ = top_ = new Link<T>( thing );
44 } else { // add at aprioprate place
45 Link<T> *p = ( after_me.ok() ) ?
46 after_me.pointer() : bottom().pointer();
48 if (p == bottom_) // adjust bottom_ if necessary.
58 \item if #after_me# is #ok()#, add after #after_me#, else
59 \item if list !empty simply add to bottom, else
60 \item list is empty: create first \Ref{Link} and initialize
67 List<T>::insert( const T& thing, Cursor<T> before_me )
70 bottom_ = top_ = new Link<T>( thing );
74 before_me.pointer() : top().pointer();
82 #if 0 // rewrite hwn 16/9
84 before_me.pointer()->insert( thing );
86 top().pointer()->insert( thing );
88 bottom_ = top_ = new Link<T>( thing );
95 List<T>::remove( Cursor<T> me )
99 me.pointer()->remove(*this);
107 List<T>::size() const
114 PointerList<T>::PointerList() :
121 PointerList<T>::PointerList( const T& thing ) :
128 PointerList<T>::~PointerList()
130 for ( Cursor<T> c( *this ); c.forward(); c++ )
136 PointerList_print( PointerList<T> const & l )
138 List<T>& promises_to_be_const = (List<T>&) l;
139 for ( Cursor<T> c( promises_to_be_const ); c.forward(); c++ )