Ignore:
File:
1 edited

Legend:

Unmodified
Added
Removed
  • libcfa/src/bits/sequence.hfa

    r7d4ce2a r8a81b09  
    22
    33#include "bits/collection.hfa"
     4#include "bits/defs.hfa"
    45
    56struct Seqable {
    6         inline Colable;
    7         Seqable * back;                                                                         // pointer to previous node in the list
     7        __cfa_anonymous_object(Colable);
     8        struct Seqable * back;                                                                          // pointer to previous node in the list
    89};
    910
    10 inline {
     11#ifdef __cforall
     12static inline {
    1113        // PUBLIC
    1214
     
    2628        }
    2729
    28         // wrappers to make Collection have T
    29         forall( dtype T ) {
    30                 T *& Back( T * n ) {
    31                         return (T *)Back( (Seqable *)n );
    32                 }
    33         } // distribution
     30        // // wrappers to make Collection have T
     31        // forall( dtype T ) {
     32        //      T *& Back( T * n ) {
     33        //              return (T *)Back( (Seqable *)n );
     34        //      }
     35        // } // distribution
    3436} // distribution
    3537
    36 forall( dtype T ) {
     38forall( dtype T | { T *& Back ( T * ); T *& Next ( T * ); bool listed ( T * ); } ) {
    3739        struct Sequence {
    3840                inline Collection;                                                              // Plan 9 inheritance
    3941        };
    4042
    41         inline {
     43        static inline {
    4244                // wrappers to make Collection have T
    4345                T & head( Sequence(T) & s ) with( s ) {
     
    184186                                T * toEnd = Back( &head( s ) );
    185187                                T * fromEnd = Back( &head( from ) );
    186                                 Back( root ) = fromEnd;
     188                                Back( (T *)root ) = fromEnd;
    187189                                Next( fromEnd ) = &head( s );
    188                                 Back( from.root ) = toEnd;
     190                                Back( (T *)from.root ) = toEnd;
    189191                                Next( toEnd ) = &head( from );
    190192                        } // if
     
    214216} // distribution
    215217
    216 forall( dtype T ) {
     218forall( dtype T | { T *& Back ( T * ); T *& Next ( T * ); bool listed ( T * ); } ) {
    217219        // SeqIter(T) is used to iterate over a Sequence(T) in head-to-tail order.
    218220        struct SeqIter {
     
    224226        };
    225227
    226         inline {
     228        static inline {
    227229                void ?{}( SeqIter(T) & si ) with( si ) {
    228230                        ((ColIter &)si){};
     
    265267        };
    266268
    267         inline {
     269        static inline {
    268270                void ?{}( SeqIterRev(T) & si ) with( si ) {     
    269271                        ((ColIter &)si){};
     
    298300        } // distribution
    299301} // distribution
     302
     303#endif
Note: See TracChangeset for help on using the changeset viewer.