Changes in libcfa/src/bits/stack.hfa [9536761:a3a76ea]
- File:
-
- 1 edited
-
libcfa/src/bits/stack.hfa (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
libcfa/src/bits/stack.hfa
r9536761 ra3a76ea 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 those6 // 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 itself9 // instead of being null.10 4 11 5 forall( dtype T | { T *& Next ( T * ); } ) { … … 64 58 } // distribution 65 59 66 // A StackIter(T) is a subclass of ColIter(T) that generates the elements of a Stack(T). It returns the elements in the67 // order returned by drop().68 60 69 61 forall( dtype T | { T *& Next ( T * ); } ) { … … 77 69 } // post: curr == 0p 78 70 79 // create an iterator active in stack s71 // create an iterator active in Stack s 80 72 void ?{}( StackIter(T) & si, Stack(T) & s ) with( si ) { 81 73 curr = &head( s ); … … 86 78 } // post: curr = {e in s} 87 79 88 // make existing iterator active in stack s80 // make existing iterator active in Stack q 89 81 void over( StackIter(T) & si, Stack(T) & s ) with( si ) { 90 82 curr = &head( s ); 91 83 } // post: curr = {e in s} 92 84 93 bool ? |?( StackIter(T) & si, T && tp ) with( si ) {85 bool ?>>?( StackIter(T) & si, T && tp ) with( si ) { 94 86 if ( curr ) { 95 87 &tp = Curr( si );
Note:
See TracChangeset
for help on using the changeset viewer.