Ignore:
File:
1 edited

Legend:

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

    r9536761 r58870e6b  
    11#pragma once
    2 #include <stdio.h> // REMOVE THIS AFTER DEBUGGING
    3 
    42
    53struct Colable {
    6         struct Colable * next;                                                                          // next node in the list
     4        Colable * next;                                                                         // next node in the list
    75        // invariant: (next != 0) <=> listed()
    86};
    9 #ifdef __cforall
    10 static inline {
     7
     8inline {
    119        // PUBLIC
    1210
     
    3028        }
    3129
    32         // // wrappers to make Collection have T
    33         // forall( dtype T ) {
    34         //      T *& Next( T * n ) {
    35         //              return (T *)Next( (Colable *)n );
    36         //      }
    37         // } // distribution
     30        // wrappers to make Collection have T
     31        forall( dtype T ) {
     32                T *& Next( T * n ) {
     33                        return (T *)Next( (Colable *)n );
     34                }
     35
     36                bool listed( T * n ) {
     37                        return Next( (Colable *)n ) != 0p;
     38                }
     39        } // distribution
    3840} // distribution
    3941
    40 forall( dtype T | { T *& Next ( T * ); } ) {
    41         bool listed( T * n ) {
    42                 return Next( n ) != 0p;
    43         }
    44 }
    4542
    4643struct Collection {
     
    4845};
    4946
    50 static inline {
     47inline {
    5148        // class invariant: root == 0 & empty() | *root in *this
    5249        void ?{}( Collection &, const Collection & ) = void; // no copy
     
    6865
    6966struct ColIter {
    70         void * curr;                                                                            // element returned by |
     67        void * curr;                                                                            // element to be returned by >>
    7168};
    7269
    73 static inline {
     70inline {
    7471        void ?{}( ColIter & colIter ) with( colIter ) {
    7572                curr = 0p;
     
    8279        } // distribution
    8380} // distribution
    84 #endif
Note: See TracChangeset for help on using the changeset viewer.