Changes in libcfa/src/bits/containers.hfa [92e7631:768bd556]
- File:
-
- 1 edited
-
libcfa/src/bits/containers.hfa (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/bits/containers.hfa
r92e7631 r768bd556 146 146 static inline forall( dtype T | is_node(T) ) { 147 147 void ?{}( __queue(T) & this ) with( this ) { 148 head{ 1p };148 head{ 0p }; 149 149 tail{ &head }; 150 verify(*tail == 1p);151 150 } 152 151 153 152 void append( __queue(T) & this, T * val ) with( this ) { 154 153 verify(tail != 0p); 155 verify(*tail == 1p);156 154 *tail = val; 157 155 tail = &get_next( *val ); 158 *tail = 1p;159 156 } 160 157 161 158 T * pop_head( __queue(T) & this ) { 162 verify(*this.tail == 1p);163 159 T * head = this.head; 164 if( head != 1p) {160 if( head ) { 165 161 this.head = get_next( *head ); 166 if( get_next( *head ) == 1p) {162 if( !get_next( *head ) ) { 167 163 this.tail = &this.head; 168 164 } 169 165 get_next( *head ) = 0p; 170 verify(*this.tail == 1p); 171 verify( get_next(*head) == 0p ); 172 return head; 173 } 174 verify(*this.tail == 1p); 175 return 0p; 166 } 167 return head; 176 168 } 177 169 … … 188 180 get_next( *val ) = 0p; 189 181 190 verify( (head == 1p) == (&head == tail) );191 verify( *tail == 1p );182 verify( (head == 0p) == (&head == tail) ); 183 verify( *tail == 0p ); 192 184 return val; 193 185 } … … 274 266 return this.head != 0; 275 267 } 276 277 void move_to_front( __dllist(T) & src, __dllist(T) & dst, T & node ) {278 remove (src, node);279 push_front(dst, node);280 }281 268 } 282 269 #undef next
Note:
See TracChangeset
for help on using the changeset viewer.