Ignore:
File:
1 edited

Legend:

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

    r19de7864 r7d4ce2a  
    22
    33#include "bits/collection.hfa"
    4 #include "bits/defs.hfa"
    54
    65struct Seqable {
    7         __cfa_anonymous_object(Colable);
    8         struct Seqable * back;                                                                          // pointer to previous node in the list
     6        inline Colable;
     7        Seqable * back;                                                                         // pointer to previous node in the list
    98};
    109
    11 #ifdef __cforall
    12 static inline {
     10inline {
    1311        // PUBLIC
    1412
     
    2826        }
    2927
    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
     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
    3634} // distribution
    3735
    38 forall( dtype T | { T *& Back ( T * ); T *& Next ( T * ); } ) {
     36forall( dtype T ) {
    3937        struct Sequence {
    4038                inline Collection;                                                              // Plan 9 inheritance
    4139        };
    4240
    43         static inline {
     41        inline {
    4442                // wrappers to make Collection have T
    4543                T & head( Sequence(T) & s ) with( s ) {
     
    186184                                T * toEnd = Back( &head( s ) );
    187185                                T * fromEnd = Back( &head( from ) );
    188                                 Back( (T *)root ) = fromEnd;
     186                                Back( root ) = fromEnd;
    189187                                Next( fromEnd ) = &head( s );
    190                                 Back( (T *)from.root ) = toEnd;
     188                                Back( from.root ) = toEnd;
    191189                                Next( toEnd ) = &head( from );
    192190                        } // if
     
    216214} // distribution
    217215
    218 forall( dtype T | { T *& Back ( T * ); T *& Next ( T * ); } ) {
     216forall( dtype T ) {
    219217        // SeqIter(T) is used to iterate over a Sequence(T) in head-to-tail order.
    220218        struct SeqIter {
     
    226224        };
    227225
    228         static inline {
     226        inline {
    229227                void ?{}( SeqIter(T) & si ) with( si ) {
    230228                        ((ColIter &)si){};
     
    267265        };
    268266
    269         static inline {
     267        inline {
    270268                void ?{}( SeqIterRev(T) & si ) with( si ) {     
    271269                        ((ColIter &)si){};
     
    300298        } // distribution
    301299} // distribution
    302 
    303 #endif
Note: See TracChangeset for help on using the changeset viewer.