Ignore:
Timestamp:
Nov 19, 2015, 6:06:12 PM (7 years ago)
Author:
Peter A. Buhr <pabuhr@…>
Branches:
aaron-thesis, arm-eh, 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, resolv-new, string, with_gc
Children:
05587c2
Parents:
d2ded3e7
Message:

allow nested routines to use type variables in containing scope, fix missing adapters, generalized iostream write

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/examples/iterator.h

    rd2ded3e7 re56cfdb0  
    1010// Created On       : Wed May 27 17:56:53 2015
    1111// Last Modified By : Peter A. Buhr
    12 // Last Modified On : Wed May 27 18:41:57 2015
    13 // Update Count     : 3
     12// Last Modified On : Thu Nov 19 17:58:28 2015
     13// Update Count     : 6
    1414//
    1515
    1616#ifndef ITERATOR_H
    1717#define ITERATOR_H
    18 
    19 #include "iostream.h"
    2018
    2119// An iterator can be used to traverse a data structure.
     
    3432};
    3533
    36 context iterator_for ( type iterator_type, type collection_type, type elt_type | iterator( iterator_type, elt_type ) ) {
     34context iterator_for( type iterator_type, type collection_type, type elt_type | iterator( iterator_type, elt_type ) ) {
    3735//      [ iterator_type begin, iterator_type end ] get_iterators( collection_type );
    3836        iterator_type begin( collection_type );
     
    4341void for_each( iterator_type begin, iterator_type end, void (*func)( elt_type ) );
    4442
    45 // writes the range [begin, end) to the given stream
    46 forall( type elt_type | writeable( elt_type ),
    47                 type iterator_type | iterator( iterator_type, elt_type ),
    48                 dtype os_type | ostream( os_type ) )
    49 void write_all( iterator_type begin, iterator_type end, os_type *os );
    50 
    51 forall( type elt_type | writeable( elt_type ),
    52                 type iterator_type | iterator( iterator_type, elt_type ),
    53                 dtype os_type | ostream( os_type ) )
    54 void write_reverse( iterator_type begin, iterator_type end, os_type *os );
     43forall( type iterator_type, type elt_type | iterator( iterator_type, elt_type ) )
     44void for_each_reverse( iterator_type begin, iterator_type end, void (*func)( elt_type ) );
    5545
    5646#endif // ITERATOR_H
Note: See TracChangeset for help on using the changeset viewer.