2 list.tcc -- implement List<T>
4 source file of the Flower Library
6 (c) 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
15 List<T>::List (List const&src)
18 // probably el stupido
19 for (Cursor<T> c (src); c.ok(); c++)
68 \item if #after_me# is #ok()#, add after #after_me#, else
69 \item if list !empty simply add to bottom, else
70 \item list is empty: create first \Ref{Link} and initialize
76 List<T>::add (T const & thing, Cursor<T> &after_me)
78 if (!size_) { // not much choice if list is empty
79 bottom_ = top_ = new Link<T>(thing);
83 else { // add at aprioprate place
86 Link<T> *p =after_me.pointer();
88 if (p == bottom_) // adjust bottom_ if necessary.
97 List<T>::insert (T const & thing, Cursor<T> &before_me)
101 bottom_ = top_ = new Link<T>(thing);
111 Link<T> *p = before_me.pointer() ;
115 top_ = p->previous();
124 List<T>::concatenate (List<T> const&s)
126 Cursor<T> b (bottom());
127 for (Cursor<T> c (s); c.ok(); c++)
134 #ifndef __CYGWIN32__ // ugh should check for some gcc/egcs version
136 // instantiate a template: explicit instantiation.
137 #define LIST_INSTANTIATE(a) template class List<a>; \
138 template class Cursor<a>; template class Link<a>
142 #define LIST_INSTANTIATE(T)\
143 static void force_list_members ()\
146 bla.top().add ((void*)0);\