Changeset 636d3715 for libcfa/src/bits/queue.hfa
- Timestamp:
- Dec 3, 2020, 11:56:01 AM (3 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 89c982c, a78c3ff, cc5cc27
- Parents:
- 1db306a
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/bits/queue.hfa
r1db306a 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){};
Note: See TracChangeset
for help on using the changeset viewer.