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 Cursor( const Cursor
<T
>& cursor
);
30 T
& operator *() { return thing(); }
31 operator T() { return thing(); }
32 Cursor
<T
> operator =( const Cursor
<T
>& c
);
34 /// make cursor with #no# items back
35 Cursor
<T
> operator -( int no
) const;
37 /// make cursor with #no# items further
38 Cursor
<T
> operator +( int no
) const;
39 int operator -(Cursor
<T
> op
) const;
40 Cursor
<T
> operator -=(int);
41 Cursor
<T
> operator +=(int);
43 /// return current and move one down
44 Cursor
<T
> operator ++( int );
46 /// return current and move one up
47 Cursor
<T
> operator --( int );
58 /** put (copy) after me in List.
59 analogously to editor. ok() interpreted as at end
62 PRE: !ok, POST: added to bottom()
64 PRE: ok, POST: added after me
66 cursor points to same object, cursor.next() is newly added
69 void add( const T
& thing
);
71 /** put (copy) before me in List.
72 analogously to editor. ok() interpreted as at begin of
75 PRE: !ok, POST: add to top()
77 PRE: ok, POST: add before me
79 cursor points to same object, cursor.previous()
80 is newly inserted object.
83 void insert( const T
& thing
);
90 /// access the list this came from
91 List
<T
>& list() const ;
93 static int compare(Cursor
<T
> a
,Cursor
<T
>b
) { return a
-b
; }
103 #include "compare.hh"
106 template_instantiate_compare(Cursor
<T
>, Cursor
<T
>::compare
, template<class T
>);
108 #include "pcursor.hh"
110 #include "cursor.inl"
111 #include "iterate.hh"