14 List<T>::List( const T& thing )
18 add( thing, Cursor<T>( *this, bottom_ ) );
25 Cursor<T> next(*this);
26 for ( Cursor<T> c( *this ); c.ok(); c = next ) {
35 List<T>::add( const T& thing, Cursor<T> after_me )
39 after_me.pointer()->add( thing );
41 bottom().pointer()->add( thing );
43 bottom_ = top_ = new Link<T>( thing );
46 if (!size_) { // not much choice if list is empty
47 bottom_ = top_ = new Link<T>( thing );
48 } else { // add at aprioprate place
49 Link<T> *p = ( after_me.ok() ) ?
50 after_me.pointer() : bottom().pointer();
52 if (p == bottom_) // adjust bottom_ if necessary.
62 \item if #after_me# is #ok()#, add after #after_me#, else
63 \item if list !empty simply add to bottom, else
64 \item list is empty: create first \Ref{Link} and initialize
71 List<T>::insert( const T& thing, Cursor<T> before_me )
74 bottom_ = top_ = new Link<T>( thing );
78 before_me.pointer() : top().pointer();
86 #if 0 // rewrite hwn 16/9
88 before_me.pointer()->insert( thing );
90 top().pointer()->insert( thing );
92 bottom_ = top_ = new Link<T>( thing );
99 List<T>::remove( Cursor<T> me )
102 Link<T> *lp = me.pointer();
111 List<T>::size() const
118 PointerList<T>::PointerList() :
125 PointerList<T>::PointerList( const T& thing ) :
132 PointerList<T>::~PointerList()
134 Cursor<T> next(*this);
135 for ( Cursor<T> c( *this ); c.ok(); c = next ) {
138 remove( c ); // PointerList::remove deletes the real data
144 PointerList_print( PointerList<T> const & l )
146 List<T>& promises_to_be_const = (List<T>&) l;
147 for ( Cursor<T> c( promises_to_be_const ); c.ok(); c++ )