Ignore:
Timestamp:
May 27, 2015, 8:33:19 PM (9 years ago)
Author:
Peter A. Buhr <pabuhr@…>
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:
00cc023
Parents:
52ac3b4
Message:

licencing: eighth groups of files

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/examples/iterator.h

    r52ac3b4 r86bd7c1f  
     1//
     2// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
     3//
     4// The contents of this file are covered under the licence agreement in the
     5// file "LICENCE" distributed with Cforall.
     6//
     7// iterator.h --
     8//
     9// Author           : Richard C. Bilson
     10// Created On       : Wed May 27 17:56:53 2015
     11// Last Modified By : Peter A. Buhr
     12// Last Modified On : Wed May 27 18:41:57 2015
     13// Update Count     : 3
     14//
     15
    116#ifndef ITERATOR_H
    217#define ITERATOR_H
     
    621// An iterator can be used to traverse a data structure.
    722context iterator( type iterator_type, type elt_type ) {
    8     // point to the next element
    9 //    iterator_type ?++( iterator_type * );
    10     iterator_type ++?( iterator_type * );
    11     iterator_type --?( iterator_type * );
     23        // point to the next element
     24//      iterator_type ?++( iterator_type * );
     25        iterator_type ++?( iterator_type * );
     26        iterator_type --?( iterator_type * );
    1227
    13     // can be tested for equality with other iterators
    14     int ?==?( iterator_type, iterator_type );
    15     int ?!=?( iterator_type, iterator_type );
     28        // can be tested for equality with other iterators
     29        int ?==?( iterator_type, iterator_type );
     30        int ?!=?( iterator_type, iterator_type );
    1631
    17     // dereference to get the pointed-at element
    18     lvalue elt_type *?( iterator_type );
     32        // dereference to get the pointed-at element
     33        lvalue elt_type *?( iterator_type );
    1934};
    2035
    2136context iterator_for ( type iterator_type, type collection_type, type elt_type | iterator( iterator_type, elt_type ) ) {
    22 //    [ iterator_type begin, iterator_type end ] get_iterators( collection_type );
    23     iterator_type begin( collection_type );
    24     iterator_type end( collection_type );
     37//      [ iterator_type begin, iterator_type end ] get_iterators( collection_type );
     38        iterator_type begin( collection_type );
     39        iterator_type end( collection_type );
    2540};
    2641
     
    3045// writes the range [begin, end) to the given stream
    3146forall( type elt_type | writeable( elt_type ),
    32         type iterator_type | iterator( iterator_type, elt_type ),
    33         dtype os_type | ostream( os_type ) )
     47                type iterator_type | iterator( iterator_type, elt_type ),
     48                dtype os_type | ostream( os_type ) )
    3449void write_all( iterator_type begin, iterator_type end, os_type *os );
    3550
    3651forall( type elt_type | writeable( elt_type ),
    37         type iterator_type | iterator( iterator_type, elt_type ),
    38         dtype os_type | ostream( os_type ) )
     52                type iterator_type | iterator( iterator_type, elt_type ),
     53                dtype os_type | ostream( os_type ) )
    3954void write_reverse( iterator_type begin, iterator_type end, os_type *os );
    4055
    4156#endif // ITERATOR_H
     57
     58// Local Variables: //
     59// tab-width: 4 //
     60// compile-command: "cfa iterator.c" //
     61// End: //
Note: See TracChangeset for help on using the changeset viewer.