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);
24 Cursor (const Cursor<T>& cursor);
29 T& operator *() { return thing(); }
30 operator T() { return thing(); }
31 Cursor<T> operator =(const Cursor<T>& c);
33 /// make cursor with #no# items back
34 Cursor<T> operator -(int no) const;
36 /// make cursor with #no# items further
37 Cursor<T> operator +(int no) const;
38 int operator -(Cursor<T> op) const;
39 Cursor<T> operator -=(int);
40 Cursor<T> operator +=(int);
45 /// return current and move one down
46 Cursor<T> operator ++(int);
48 /// return current and move one up
49 Cursor<T> operator --(int);
58 bool backward() const;
60 /** put (copy) after me in List.
61 analogously to editor. ok() interpreted as at end
64 PRE: !ok, POST: added to bottom()
66 PRE: ok, POST: added after me
68 cursor points to same object, cursor.next() is newly added
71 void add (T const & thing);
73 /** put (copy) before me in List.
74 analogously to editor. ok() interpreted as at begin of
77 PRE: !ok, POST: add to top()
79 PRE: ok, POST: add before me
81 cursor points to same object, cursor.previous()
82 is newly inserted object.
85 void insert (T const & thing);
92 /// access the list this came from
93 List<T>* list_l() const ;
95 static int compare (Cursor<T> a,Cursor<T>b) { return a-b; }
107 #include "compare.hh"
110 TEMPLATE_INSTANTIATE_COMPARE(Cursor<T>, Cursor<T>::compare, template<class T>);
112 #include "pcursor.hh"
114 #include "cursor.icc"
115 #include "iterate.hh"