Changeset 134b86a for translator/examples/iterator.c
- Timestamp:
- Nov 3, 2014, 4:38:08 PM (10 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- 8c17ab0
- Parents:
- 93885663
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
translator/examples/iterator.c
r93885663 r134b86a 18 18 type iterator_type | iterator( iterator_type, elt_type ), 19 19 dtype os_type | ostream( os_type ) ) 20 void 21 write_all( iterator_type begin, iterator_type end, os_type *os ) 22 { 23 iterator_type i; 24 for( i = begin; i != end; ++i ) { 25 os << *i << ' '; 26 } 20 void write_all( iterator_type begin, iterator_type end, os_type *os ) { 21 iterator_type i; 22 for ( i = begin; i != end; ++i ) { 23 os << *i << ' '; 24 } 27 25 } 28 26 27 forall( type elt_type | writeable( elt_type ), 28 type iterator_type | iterator( iterator_type, elt_type ), 29 dtype os_type | ostream( os_type ) ) 30 void write_reverse( iterator_type begin, iterator_type end, os_type *os ) { 31 iterator_type i; /* = end; do not work */ 32 i = end; 33 do { 34 --i; 35 os << *i << ' '; 36 } while ( i != begin ); 37 }
Note: See TracChangeset
for help on using the changeset viewer.