50 #include "EST_common.h"
51 #include "EST_UList.h"
52 #include "EST_TSortable.h"
53 #include "EST_TIterator.h"
55 #include "instantiate/EST_TListI.h"
63 static void *
operator new(
size_t not_used,
void *place)
64 {(void)not_used;
return place;}
65 static void *
operator new(
size_t size)
67 p = (
void *)walloc(
char,size);
69 static void operator delete(
void *p)
73 static unsigned int s_nfree;
74 static unsigned int s_maxFree;
113 void init() { EST_UList::init(); };
122 ~
EST_TList() { clear_and_free(free_item); }
140 {
return item(nth_pointer(n)); };
142 const T &nth(
int n)
const
143 {
return item(nth_pointer(n)); };
146 const T &first()
const
147 {
return item(head()); };
149 const T &last()
const
150 {
return item(tail()); };
155 {
return item(head()); };
158 {
return item(tail()); };
162 {
return item(ptr); };
165 {
return item(ptr); };
176 {
return EST_UList::remove(ptr, free_item); };
180 {
return EST_UList::remove(n, free_item); };
191 void append(
const T &item)
194 void prepend(
const T &item)
215 { EST_UList::exchange(a, b); };
217 void exchange(
int i,
int j)
218 { EST_UList::exchange(i,j); };
231 friend ostream& operator << (ostream &st, EST_TList<T>
const &list) {
233 for (ptr = list.head(); ptr != 0; ptr = ptr->next())
234 st << list.item(ptr) <<
" ";
240 { clear_and_free(free_item); };
248 void point_to_first(
IPointer &ip)
const { ip.p = head(); }
249 void move_pointer_forwards(IPointer &ip)
const { ip.p = ip.p->next(); }
250 bool points_to_something(
const IPointer &ip)
const {
return ip.p != NULL; }
251 T &points_at(
const IPointer &ip) {
return item(ip.p); }
304 EST_UList::sort_unique(l,
313 EST_UList::merge_sort_unique(l, m,
320 const char *error_name(
EST_TList<T> val) { (void)val;
return "<<TLIST>>"; }