Ignore:
Timestamp:
Dec 3, 2020, 8:58:29 PM (3 years ago)
Author:
Thierry Delisle <tdelisle@…>
Branches:
ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
Children:
032fd93
Parents:
cf2257f (diff), 7b2a786 (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the (diff) links above to see all the changes relative to each parent.
Message:

Merge branch 'master' of plg.uwaterloo.ca:software/cfa/cfa-cc

File:
1 edited

Legend:

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

    rcf2257f r1de50a9  
    1010        inline {
    1111                // wrappers to make Collection have T
    12                 T * head( Stack(T) & s ) with( s ) {
    13                         return (T *)head( (Collection &)s );
     12                T & head( Stack(T) & s ) with( s ) {
     13                        return *(T *)head( (Collection &)s );
    1414                } // post: empty() & head() == 0 | !empty() & head() in *this
    1515
     
    2222
    2323                T & top( Stack(T) & s ) with( s ) {
    24                         return *head( s );
     24                        return head( s );
    2525                }
    2626
     
    2929                        if ( listed( (Colable &)(n) ) ) abort( "(Stack &)%p.addHead( %p ) : Node is already on another list.", &s, n );
    3030#endif // __CFA_DEBUG__
    31                         Next( &n ) = head( s ) ? head( s ) : &n;
     31                        Next( &n ) = &head( s ) ? &head( s ) : &n;
    3232                        root = &n;
    3333                }
     
    4242
    4343                T & drop( Stack(T) & s ) with( s ) {
    44                         T & t = *head( s );
     44                        T & t = head( s );
    4545                        if ( root ) {
    4646                                root = ( T *)Next(root);
    47                                 if ( head( s ) == &t ) root = 0p;               // only one element ?
     47                                if ( &head( s ) == &t ) root = 0p;              // only one element ?
    4848                                Next( &t ) = 0p;
    4949                        } // if
     
    7070                // create an iterator active in Stack s
    7171                void ?{}( StackIter(T) & si, Stack(T) & s ) with( si ) {
    72                         curr = head( s );
     72                        curr = &head( s );
    7373                } // post: curr = {e in s}
    7474
     
    7979                // make existing iterator active in Stack q
    8080                void over( StackIter(T) & si, Stack(T) & s ) with( si ) {
    81                         curr = head( s );
     81                        curr = &head( s );
    8282                } // post: curr = {e in s}
    8383
Note: See TracChangeset for help on using the changeset viewer.