Ignore:
File:
1 edited

Legend:

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

    r3d0560d r5e82d56  
    116116
    117117                // Insert *n into the sequence after *aft, or at the beginning if aft == 0.
    118                 void insertAft( Sequence(T) & s, T * aft, T * n ) with( s ) {   // pre: !n->listed() & *aft in *s
     118                void insertAft( Sequence(T) & s, T *aft, T *n ) with( s ) {     // pre: !n->listed() & *aft in *s
    119119#ifdef __CFA_DEBUG__
    120120                        if ( listed( n ) ) abort( "(Sequence &)%p.insertAft( %p, %p ) : Node is already on another list.", &s, aft, n );
     
    145145               
    146146                // pre: n->listed() & *n in *s
    147                 void remove( Sequence(T) & s, T * n ) with( s ) { // O(1)
     147                void remove( Sequence(T) & s, T *n ) with( s ) { // O(1)
    148148#ifdef __CFA_DEBUG__
    149149                        if ( ! listed( n ) ) abort( "(Sequence &)%p.remove( %p ) : Node is not on a list.", &s, n );
     
    159159
    160160                // Add an element to the head of the sequence.
    161                 void addHead( Sequence(T) & s, T * n ) {                // pre: !n->listed(); post: n->listed() & head() == n
     161                void addHead( Sequence(T) & s, T *n ) {                 // pre: !n->listed(); post: n->listed() & head() == n
    162162                        insertAft( s, 0, n );
    163163                }
    164164                // Add an element to the tail of the sequence.
    165                 void addTail( Sequence(T) & s, T * n ) {                // pre: !n->listed(); post: n->listed() & head() == n
     165                void addTail( Sequence(T) & s, T *n ) {                 // pre: !n->listed(); post: n->listed() & head() == n
    166166                        insertBef( s, n, 0 );
    167167                }
    168168                // Add an element to the tail of the sequence.
    169                 void add( Sequence(T) & s, T * n ) {                    // pre: !n->listed(); post: n->listed() & head() == n
     169                void add( Sequence(T) & s, T *n ) {                             // pre: !n->listed(); post: n->listed() & head() == n
    170170                        addTail( s, n );
    171171                }
     
    244244                        ((ColIter &) si){};
    245245                        seq = &s;
    246                         curr = head( s );
    247246                } // post: elts = null.
    248247               
     
    252251                } // post: elts = {e in s}.
    253252
    254                 bool ?>>?( SeqIter(T) & si, T && tp ) with( si ) {
     253                bool ?>>?( SeqIter(T) & si, T *& tp ) with( si ) {
    255254                        if ( curr ) {
    256                                 &tp = Curr( si );
    257                                 T * n = succ( *seq, Curr( si ) );
     255                                tp = Curr( si );
     256                                T *n = succ( *seq, Curr( si ) );
    258257                                curr = n == head( *seq ) ? 0p : n;
    259                         } else &tp = 0p;
    260                         return &tp != 0p;
     258                        } else tp = 0p;
     259                        return tp != 0p;
    261260                }
    262261        } // distribution
     
    283282                        ((ColIter &) si){};
    284283                        seq = &s;
    285                         curr = tail( s );
    286284                } // post: elts = null.
    287285               
     
    291289                } // post: elts = {e in s}.
    292290
    293                 bool ?>>?( SeqIterRev(T) & si, T && tp ) with( si ) {
     291                bool ?>>?( SeqIterRev(T) & si, T *&tp ) with( si ) {
    294292                        if ( curr ) {
    295                                 &tp = Curr( si );
    296                                 T * n = pred( *seq, Curr( si ) );
     293                                tp = Curr( si );
     294                                T *n = pred( *seq, Curr( si ) );
    297295                                curr = n == tail( *seq ) ? 0p : n;
    298                         } else &tp = 0p;
    299                         return &tp != 0p;
     296                        } else tp = 0p;
     297                        return tp != 0p;
    300298                }
    301299        } // distribution
Note: See TracChangeset for help on using the changeset viewer.