Ignore:
File:
1 edited

Legend:

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

    ra3a76ea r19de7864  
    7777
    7878                // Insert *n into the sequence before *bef, or at the end if bef == 0.
    79                 T & insertBef( Sequence(T) & s, T & n, T & bef ) with( s ) { // pre: !n->listed() & *bef in *s
     79                void insertBef( Sequence(T) & s, T & n, T & bef ) with( s ) { // pre: !n->listed() & *bef in *s
    8080                        #ifdef __CFA_DEBUG__
    8181                        if ( listed( &n ) ) abort( "(Sequence &)%p.insertBef( %p, %p ) : Node is already on another list.", &s, n, &bef );
     
    105105                                Next( Back( &n ) ) = &n;
    106106                        } // if
    107                         return n;
    108107                }       // post: n->listed() & *n in *s & succ(n) == bef
    109108
    110109
    111110                // Insert *n into the sequence after *aft, or at the beginning if aft == 0.
    112                 T & insertAft( Sequence(T) & s, T & aft, T & n ) with( s ) {    // pre: !n->listed() & *aft in *s
     111                void insertAft( Sequence(T) & s, T & aft, T & n ) with( s ) {   // pre: !n->listed() & *aft in *s
    113112                        #ifdef __CFA_DEBUG__
    114113                        if ( listed( &n ) ) abort( "(Sequence &)%p.insertAft( %p, %p ) : Node is already on another list.", &s, &aft, &n );
     
    136135                                Next( &aft ) = &n;
    137136                        } // if
    138                         return n;
    139137                }         // post: n->listed() & *n in *s & succ(n) == bef
    140138               
    141139                // pre: n->listed() & *n in *s
    142                 T & remove( Sequence(T) & s, T & n ) with( s ) { // O(1)
     140                void remove( Sequence(T) & s, T & n ) with( s ) { // O(1)
    143141                        #ifdef __CFA_DEBUG__
    144142                        if ( ! listed( &n ) ) abort( "(Sequence &)%p.remove( %p ) : Node is not on a list.", &s, &n );
     
    151149                        Next( Back( &n ) ) = Next( &n );
    152150                        Next( &n ) = Back( &n ) = 0p;
    153                         return n;
    154151                }                                                       // post: !n->listed().
    155152
    156153                // Add an element to the head of the sequence.
    157                 T & addHead( Sequence(T) & s, T & n ) {                 // pre: !n->listed(); post: n->listed() & head() == n
    158                         return insertAft( s, *0p, n );
     154                void addHead( Sequence(T) & s, T & n ) {                // pre: !n->listed(); post: n->listed() & head() == n
     155                        insertAft( s, *0p, n );
    159156                }
    160157                // Add an element to the tail of the sequence.
    161                 T & addTail( Sequence(T) & s, T & n ) {                 // pre: !n->listed(); post: n->listed() & head() == n
    162                         return insertBef( s, n, *0p );
     158                void addTail( Sequence(T) & s, T & n ) {                // pre: !n->listed(); post: n->listed() & head() == n
     159                        insertBef( s, n, *0p );
    163160                }
    164161                // Add an element to the tail of the sequence.
    165                 T & add( Sequence(T) & s, T & n ) {                             // pre: !n->listed(); post: n->listed() & head() == n
    166                         return addTail( s, n );
     162                void add( Sequence(T) & s, T & n ) {                    // pre: !n->listed(); post: n->listed() & head() == n
     163                        addTail( s, n );
    167164                }
    168165                // Remove and return the head element in the sequence.
Note: See TracChangeset for help on using the changeset viewer.