Changeset 3e36f220 for libcfa/src/bits/stack.hfa
- Timestamp:
- Dec 28, 2020, 4:13:58 PM (5 years ago)
- Branches:
- ADT, arm-eh, ast-experimental, enum, forall-pointer-decay, jacob/cs343-translation, master, new-ast-unique-expr, pthread-emulation, qualifiedEnum
- Children:
- 6ae5c22
- Parents:
- b6460bf (diff), bf1914e (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. - File:
-
- 1 edited
-
libcfa/src/bits/stack.hfa (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/bits/stack.hfa
rb6460bf r3e36f220 2 2 3 3 #include "bits/collection.hfa" 4 5 // A Stack(T) is a Collection(T) defining the ordering that nodes are returned by drop() in the reverse order from those 6 // added by add(). T must be a public descendant of uColable. 7 8 // The implementation is a typical singly-linked list, except the next field of the last element points to itself 9 // instead of being null. 4 10 5 11 forall( dtype T | { T *& Next ( T * ); } ) { … … 58 64 } // distribution 59 65 66 // A StackIter(T) is a subclass of ColIter(T) that generates the elements of a Stack(T). It returns the elements in the 67 // order returned by drop(). 60 68 61 69 forall( dtype T | { T *& Next ( T * ); } ) { … … 69 77 } // post: curr == 0p 70 78 71 // create an iterator active in Stack s79 // create an iterator active in stack s 72 80 void ?{}( StackIter(T) & si, Stack(T) & s ) with( si ) { 73 81 curr = &head( s ); … … 78 86 } // post: curr = {e in s} 79 87 80 // make existing iterator active in Stack q88 // make existing iterator active in stack s 81 89 void over( StackIter(T) & si, Stack(T) & s ) with( si ) { 82 90 curr = &head( s ); 83 91 } // post: curr = {e in s} 84 92 85 bool ? >>?( StackIter(T) & si, T && tp ) with( si ) {93 bool ?|?( StackIter(T) & si, T && tp ) with( si ) { 86 94 if ( curr ) { 87 95 &tp = Curr( si );
Note:
See TracChangeset
for help on using the changeset viewer.