Changes in libcfa/src/bits/sequence.hfa [19de7864:7d4ce2a]
- File:
-
- 1 edited
-
libcfa/src/bits/sequence.hfa (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/bits/sequence.hfa
r19de7864 r7d4ce2a 2 2 3 3 #include "bits/collection.hfa" 4 #include "bits/defs.hfa"5 4 6 5 struct Seqable { 7 __cfa_anonymous_object(Colable);8 structSeqable * back; // pointer to previous node in the list6 inline Colable; 7 Seqable * back; // pointer to previous node in the list 9 8 }; 10 9 11 #ifdef __cforall 12 static inline { 10 inline { 13 11 // PUBLIC 14 12 … … 28 26 } 29 27 30 // //wrappers to make Collection have T31 //forall( dtype T ) {32 //T *& Back( T * n ) {33 //return (T *)Back( (Seqable *)n );34 //}35 //} // distribution28 // wrappers to make Collection have T 29 forall( dtype T ) { 30 T *& Back( T * n ) { 31 return (T *)Back( (Seqable *)n ); 32 } 33 } // distribution 36 34 } // distribution 37 35 38 forall( dtype T | { T *& Back ( T * ); T *& Next ( T * ); }) {36 forall( dtype T ) { 39 37 struct Sequence { 40 38 inline Collection; // Plan 9 inheritance 41 39 }; 42 40 43 staticinline {41 inline { 44 42 // wrappers to make Collection have T 45 43 T & head( Sequence(T) & s ) with( s ) { … … 186 184 T * toEnd = Back( &head( s ) ); 187 185 T * fromEnd = Back( &head( from ) ); 188 Back( (T *)root ) = fromEnd;186 Back( root ) = fromEnd; 189 187 Next( fromEnd ) = &head( s ); 190 Back( (T *)from.root ) = toEnd;188 Back( from.root ) = toEnd; 191 189 Next( toEnd ) = &head( from ); 192 190 } // if … … 216 214 } // distribution 217 215 218 forall( dtype T | { T *& Back ( T * ); T *& Next ( T * ); }) {216 forall( dtype T ) { 219 217 // SeqIter(T) is used to iterate over a Sequence(T) in head-to-tail order. 220 218 struct SeqIter { … … 226 224 }; 227 225 228 staticinline {226 inline { 229 227 void ?{}( SeqIter(T) & si ) with( si ) { 230 228 ((ColIter &)si){}; … … 267 265 }; 268 266 269 staticinline {267 inline { 270 268 void ?{}( SeqIterRev(T) & si ) with( si ) { 271 269 ((ColIter &)si){}; … … 300 298 } // distribution 301 299 } // distribution 302 303 #endif
Note:
See TracChangeset
for help on using the changeset viewer.