Changes in libcfa/src/bits/queue.hfa [5e82d56:636d3715]
- File:
-
- 1 edited
-
libcfa/src/bits/queue.hfa (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/bits/queue.hfa
r5e82d56 r636d3715 14 14 return (T *)head( (Collection &)q ); 15 15 } // post: empty() & head() == 0 | !empty() & head() in *q 16 17 bool empty( Queue(T) & q ) with( q ) { // 0 <=> *q contains no elements18 return empty( (Collection &)q );19 }20 21 bool listed( T * n ) {22 return Next( (Colable *)n ) != 0;23 }24 25 T *& Next( T * n ) {26 return (T *)Next( (Colable *)n );27 }28 29 T * Root( Queue(T) & q ) with( q ) {30 return (T *)root;31 }32 16 33 17 void ?{}( Queue(T) &, const Queue(T) & ) = void; // no copy … … 55 39 #endif // __CFA_DEBUG__ 56 40 if ( last ) { 57 Next( n ) = Root( q );41 Next( n ) = head( q ); 58 42 q.root = n; 59 43 } else { … … 81 65 if ( root ) { 82 66 root = Next( root ); 83 if ( Root( q ) == t ) {67 if ( head( q ) == t ) { 84 68 root = last = 0p; // only one element 85 69 } … … 132 116 root = from.root; 133 117 } else { // "to" list not empty 134 Next( last ) = Root( from );118 Next( last ) = head( from ); 135 119 } 136 120 last = from.last; … … 148 132 to.last = n; // end of "to" list 149 133 from.root = Next( n ); // start of "from" list 150 if ( n == Root( from ) ) { // last node in list ?134 if ( n == head( from ) ) { // last node in list ? 151 135 from.root = from.last = 0p; // mark "from" list empty 152 136 } else { … … 164 148 165 149 inline { 166 // wrappers to make ColIter have T167 T * Curr( QueueIter(T) & qi ) with( qi ) {168 return (T *)curr;169 }170 171 150 void ?{}( QueueIter(T) & qi ) with( qi ) { 172 151 ((ColIter &)qi){}; … … 187 166 } // post: curr = {e in q} 188 167 189 bool ?>>?( QueueIter(T) & qi, T *& tp ) with( qi ) {168 bool ?>>?( QueueIter(T) & qi, T && tp ) with( qi ) { 190 169 if ( curr ) { 191 tp = Curr( qi );170 &tp = Curr( qi ); 192 171 T * n = Next( Curr( qi ) ); 193 172 curr = (n == Curr( qi ) ) ? 0p : n; 194 } else tp = 0p;195 return tp != 0p;173 } else &tp = 0p; 174 return &tp != 0p; 196 175 } 197 176 // post: elts == null & !operator>>(tp) | elts != null & *tp' in elts & elts' == elts - *tp & operator>>(tp)
Note:
See TracChangeset
for help on using the changeset viewer.