3 // GROUPS passed old-abort
12 ListDProto(const ListDProto&);
13 virtual ~ListDProto();
14 void operator=(const ListDProto&);
15 unsigned length() const;
23 friend int operator==(void *v, const Vix& x)
24 { return v == x.item; }
25 friend int operator==(const Vix& x, void *v)
26 { return v == x.item; }
27 friend int operator!=(void *v, const Vix& x)
28 { return v != x.item; }
29 friend int operator!=(const Vix& x, void *v)
30 { return v != x.item; }
31 friend int operator==(const Vix& x1, const Vix& x2)
32 { return x1.owner == x2.owner && x1.item == x2.item; }
33 friend int operator!=(const Vix& x1, const Vix& x2)
34 { return x1.owner != x2.owner || x1.item != x2.item; }
38 friend class ListDProto;
39 Vix(const ListDProto *o, link *i);
40 const ListDProto *owner;
44 enum Action { NORMAL, REMOVE_CURRENT };
46 void first(Vix& x) const;
47 void next(Vix& x) const;
48 void next(Vix& x, Action a = NORMAL);
50 void last(Vix& x) const;
51 void prev(Vix& x) const;
52 void prev(Vix& x, Action a = NORMAL);
57 link(link *n = 0, link *p = 0);
61 void operator=(const link&);
66 virtual link *copy_item(link *old_item) const = 0;
67 void prepend(link *item);
68 void append(link *item);
69 void prepend(const ListDProto& proto);
70 void append(const ListDProto& proto);
71 void remove(link *item);
72 link *ref(const Vix&) const;
75 class ListD: public ListDProto {
77 void prepend(const T& item);
78 void append(const T& item);
79 const T& head() const;
81 void head(T& fill) const;
83 { ListDProto::remove_head(); }
84 void remove_head(T& fill);
85 const T& tail() const;
87 void tail(T& fill) const;
89 { ListDProto::remove_tail(); }
90 void remove_tail(T& fill);
91 class Vix: public ListDProto::Vix {
93 Vix(): ListDProto::Vix()
96 friend class ListD<T>;
97 Vix(const ListDProto::Vix& x): ListDProto::Vix(x)
101 { return ListDProto::first(); };
102 void first(Vix& x) const
103 { ListDProto::first(x); };
104 void next(Vix& x, ListDProto::Action a = NORMAL) const
105 { ListDProto::next(x, a); }// { dg-error "" } .*// ERROR - .*
107 { return ListDProto::last(); }
108 void last(Vix& x) const
109 { return ListDProto::last(x); }
110 void prev(Vix& x, ListDProto::Action a = NORMAL) const
111 { return ListDProto::prev(x, a); }
113 struct link_item: public ListDProto::link {
115 link_item(const T& i): link(0, 0), item(i)
118 link_item(const link_item&);
119 void operator=(const link_item&);
122 T& operator()(const Vix& x)
123 { link_item *li = (link_item *) ref(x);
125 const T& operator()(const Vix& x) const
126 { link_item *li = (link_item *) ref(x);
129 ListDProto::link *copy_item(ListDProto::link *old_item) const;
132 class SetLD: private ListD<T> {
135 SetLD(const ListD<T>&);
136 void add(const T& item);
137 void add(const ListD<T>& other);
138 void add(const SetLD<T>& other);
139 void remove(const T& item);
140 bool contains(const T& item) const;
144 typedef typename ListD<T>::Vix Vix;
147 ListD<T>::operator();
149 using ListD<T>::NORMAL;
150 using ListD<T>::REMOVE_CURRENT;
153 extern void __eprintf (const char *, const char *, unsigned, const char *);
156 extern void __eprintf (const char *, const char *, unsigned, const char *);
160 ListD<T>::prepend(const T& item)
162 link *newl = new link_item(item);
163 ListDProto::prepend(newl);
167 ListD<T>::append(const T& item)
169 link *newl = new link_item(item);
170 ListDProto::append(newl);
174 ListD<T>::head() const
176 ((void) (( 0 != list_head ) ? 0 : (__eprintf ("%s:%u: failed assertion `%s'\n", "/home/wbaker/work/include/templates/ListD.body.h" , 50 , "0 != list_head" ), 0) )) ;
177 link_item *h = (link_item *) list_head;
184 ((void) (( 0 != list_head ) ? 0 : (__eprintf ("%s:%u: failed assertion `%s'\n", "/home/wbaker/work/include/templates/ListD.body.h" , 59 , "0 != list_head" ), 0) )) ;
185 link_item *h = (link_item *) list_head;
190 ListD<T>::head(T& fill) const
192 ((void) (( 0 != list_head ) ? 0 : (__eprintf ("%s:%u: failed assertion `%s'\n", "/home/wbaker/work/include/templates/ListD.body.h" , 68 , "0 != list_head" ), 0) )) ;
193 link_item *h = (link_item *) list_head;
198 ListD<T>::remove_head(T& fill)
205 ListD<T>::tail() const
207 ((void) (( 0 != list_tail ) ? 0 : (__eprintf ("%s:%u: failed assertion `%s'\n", "/home/wbaker/work/include/templates/ListD.body.h" , 85 , "0 != list_tail" ), 0) )) ;
208 link_item *h = (link_item *) list_tail;
215 ((void) (( 0 != list_tail ) ? 0 : (__eprintf ("%s:%u: failed assertion `%s'\n", "/home/wbaker/work/include/templates/ListD.body.h" , 94 , "0 != list_tail" ), 0) )) ;
216 link_item *h = (link_item *) list_tail;
221 ListD<T>::tail(T& fill) const
223 ((void) (( 0 != list_tail ) ? 0 : (__eprintf ("%s:%u: failed assertion `%s'\n", "/home/wbaker/work/include/templates/ListD.body.h" , 103 , "0 != list_tail" ), 0) )) ;
224 link_item *h = (link_item *) list_tail;
229 ListD<T>::remove_tail(T& fill)
231 ((void) (( 0 != list_tail ) ? 0 : (__eprintf ("%s:%u: failed assertion `%s'\n", "/home/wbaker/work/include/templates/ListD.body.h" , 112 , "0 != list_tail" ), 0) )) ;
232 link_item *h = (link_item *) list_tail;
237 ListD<T>::copy_item(ListDProto::link *old) const
239 link_item *old_item = (link_item *) old;
240 link_item *new_item = new link_item(old_item->item);
248 SetLD<T>::SetLD(const ListD<T>& other):
253 SetLD<T>::add(const T& item)
255 if ( ! contains(item) )
260 SetLD<T>::add(const ListD<T>& other)
262 typename ListD<T>::Vix x;
263 for (first(x); 0 != x; next(x))
268 SetLD<T>::add(const SetLD<T>& other)
270 const ListD<T>& lother = other;
275 SetLD<T>::remove(const T& item)
277 typename ListD<T>::Action a = this->NORMAL;
279 for (first(x); 0 != x && this->REMOVE_CURRENT != a; next(x, a))
280 a = operator()(x) == item ? this->REMOVE_CURRENT: this->NORMAL; // { dg-error "" } .*
281 // { dg-message "candidate" "candidate note" { target *-*-* } 280 }
285 SetLD<T>::contains(const T& item) const
288 for (first(x); 0 != x; next(x)) {
289 if (operator()(x) == item)// { dg-error "" } .*
290 // { dg-message "candidate" "candidate note" { target *-*-* } 289 }
297 operator==(const SetLD<T>& a, const SetLD<T>& b) // { dg-message "note" }
299 if (a.length() != b.length())
301 typename SetLD<T>::Vix x;
302 for (a.first(x); 0 != x; a.next(x)) {
303 if ( ! b.contains(a(x)) )
306 for (b.first(x); 0 != x; b.next(x)) {
307 if ( ! a.contains(b(x)) )
314 operator!=(const SetLD<T>& a, const SetLD<T>& b)
315 { return ! (a == b); }
318 operator<=(const SetLD<T>& a, const SetLD<T>& b)
320 if (a.length() > b.length())
322 typename SetLD<T>::Vix x;
323 for (x=a.first(); 0 != x; a.next(x)) {
324 if ( ! b.contains(a(x)) )
331 operator<(const SetLD<T>& a, const SetLD<T>& b)
333 if (a.length() >= b.length())
339 operator>(const SetLD<T>& a, const SetLD<T>& b)
340 { return ! (a <= b); }
343 operator>=(const SetLD<T>& a, const SetLD<T>& b)
344 { return ! (a < b); }
346 class IcaseString: public String { };
347 template <> class SetLD< IcaseString >: public SetLD< String > { public: SetLD (): SetLD< String >() { }; SetLD (const ::ListD< IcaseString >& other): SetLD< String >() { ::ListD< IcaseString >::Vix x; for (other.first(x); 0 != x; other.next(x)) add(other(x)); }; SetLD (const SetLD & other): SetLD< String >(other) { }; const IcaseString & operator()(const Vix& x) const { return ( IcaseString &) SetLD< String >::operator()(x); } }; typedef SetLD< String > SetLD_String_IcaseString_old_tmp99; typedef SetLD< IcaseString > SetLD_String_IcaseString_new_tmp99;
348 inline int operator== (const SetLD_String_IcaseString_new_tmp99& a, const SetLD_String_IcaseString_new_tmp99& b) // { dg-message "operator==|no known conversion" }
350 const SetLD_String_IcaseString_old_tmp99& oa = a;
351 const SetLD_String_IcaseString_old_tmp99& ob = b;
352 return operator== (oa, ob); }
353 inline int operator!= (const SetLD_String_IcaseString_new_tmp99& a, const SetLD_String_IcaseString_new_tmp99& b)
355 const SetLD_String_IcaseString_old_tmp99& oa = a;
356 const SetLD_String_IcaseString_old_tmp99& ob = b;
357 return operator!= (oa, ob); }
358 inline int operator< (const SetLD_String_IcaseString_new_tmp99& a, const SetLD_String_IcaseString_new_tmp99& b)
360 const SetLD_String_IcaseString_old_tmp99& oa = a;
361 const SetLD_String_IcaseString_old_tmp99& ob = b;
362 return operator< (oa, ob); }
363 inline int operator<= (const SetLD_String_IcaseString_new_tmp99& a, const SetLD_String_IcaseString_new_tmp99& b)
365 const SetLD_String_IcaseString_old_tmp99& oa = a;
366 const SetLD_String_IcaseString_old_tmp99& ob = b;
367 return operator<= (oa, ob); }
368 inline int operator> (const SetLD_String_IcaseString_new_tmp99& a, const SetLD_String_IcaseString_new_tmp99& b)
370 const SetLD_String_IcaseString_old_tmp99& oa = a;
371 const SetLD_String_IcaseString_old_tmp99& ob = b;
372 return operator> (oa, ob); }
373 inline int operator>= (const SetLD_String_IcaseString_new_tmp99& a, const SetLD_String_IcaseString_new_tmp99& b)
375 const SetLD_String_IcaseString_old_tmp99& oa = a;
376 const SetLD_String_IcaseString_old_tmp99& ob = b;
377 return operator>= (oa, ob); }
378 typedef SetLD<IcaseString> SLDiS;
382 SetLD<IcaseString> x, y;
391 template class SetLD<String>;