7 template<class T> class List;
10 add and insert extend the list
11 items are always stored as copies in List, but:
12 List<String> : copies of String stored
13 List<String*> : copies of String* stored!
15 the operations add and insert actually delegate the work to List class.
21 /** create cursor, set at top. The const part isn't true, actually, #list#
22 surely isn't const, but I get tired of the warning messages. */
23 Cursor( const List<T>& list, Link<T>* pointer = 0 );
25 Create an invalid cursor (pointing to nothing, associated with no list.)
28 Cursor( const Cursor<T>& cursor );
33 T& operator *() { return thing(); }
34 operator T() { return thing(); }
35 Cursor<T> operator =( const Cursor<T>& c );
37 /// make cursor with #no# items back
38 Cursor<T> operator -( int no) const;
40 /// make cursor with #no# items further
41 Cursor<T> operator +( int no) const;
42 int operator -(Cursor<T> op) const;
43 Cursor<T> operator -=(int);
44 Cursor<T> operator +=(int);
46 /// return current and move one down
47 Cursor<T> operator ++( int );
49 /// return current and move one up
50 Cursor<T> operator --( int );
61 /** put (copy) after me in List.
62 analogously to editor. ok() interpreted as at end
65 PRE: !ok, POST: added to bottom()
67 PRE: ok, POST: added after me
69 cursor points to same object, cursor.next() is newly added
72 void add( T const & thing );
74 /** put (copy) before me in List.
75 analogously to editor. ok() interpreted as at begin of
78 PRE: !ok, POST: add to top()
80 PRE: ok, POST: add before me
82 cursor points to same object, cursor.previous()
83 is newly inserted object.
86 void insert( T const & thing );
93 /// access the list this came from
94 List<T>& list() const ;
96 static int compare(Cursor<T> a,Cursor<T>b) { return a-b; }
106 #include "compare.hh"
109 template_instantiate_compare(Cursor<T>, Cursor<T>::compare, template<class T>);
111 #include "pcursor.hh"
113 #include "cursor.icc"
114 #include "iterate.hh"