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);
49 /// return current and move one down
50 Cursor<T> operator ++( int );
52 /// return current and move one up
53 Cursor<T> operator --( int );
64 /** put (copy) after me in List.
65 analogously to editor. ok() interpreted as at end
68 PRE: !ok, POST: added to bottom()
70 PRE: ok, POST: added after me
72 cursor points to same object, cursor.next() is newly added
75 void add( T const & thing );
77 /** put (copy) before me in List.
78 analogously to editor. ok() interpreted as at begin of
81 PRE: !ok, POST: add to top()
83 PRE: ok, POST: add before me
85 cursor points to same object, cursor.previous()
86 is newly inserted object.
89 void insert( T const & thing );
96 /// access the list this came from
97 List<T>& list() const ;
99 static int compare(Cursor<T> a,Cursor<T>b) { return a-b; }
109 #include "compare.hh"
112 template_instantiate_compare(Cursor<T>, Cursor<T>::compare, template<class T>);
114 #include "pcursor.hh"
116 #include "cursor.icc"
117 #include "iterate.hh"