Changes in libcfa/src/bits/stack.hfa [a3a76ea:9536761]
- File:
-
- 1 edited
-
libcfa/src/bits/stack.hfa (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/bits/stack.hfa
ra3a76ea r9536761 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.