Ignore:
Timestamp:
Nov 3, 2014, 4:38:08 PM (10 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:
8c17ab0
Parents:
93885663
Message:

add compiler flag to driver, update examples, fix unnamed bit fields

File:
1 edited

Legend:

Unmodified
Added
Removed
  • translator/examples/array.h

    r93885663 r134b86a  
    22#define ARRAY_H
    33
    4 #include "iterator.h"
     4//#include "iterator.h"
    55
    6 context array( type array_type, type elt_type )
    7 {
    8   lvalue elt_type ?[?]( array_type, int );
     6// An array has contiguous elements accessible in any order using integer indicies. The first
     7// element has index 0.
     8context array( type array_type, type elt_type ) {
     9    lvalue elt_type ?[?]( array_type, int );
    910};
    1011
    11 context bounded_array( type array_type, type elt_type | array( array_type, elt_type ) )
    12 {
    13   int array_last( array_type );
     12// A bounded array is an array that carries its maximum index with it.
     13context bounded_array( type array_type, type elt_type | array( array_type, elt_type ) ) {
     14    int last( array_type );
    1415};
    1516
     
    1718
    1819typedef int array_iterator;
     20
    1921/// forall( type array_type, elt_type | bounded_array( array_type, elt_type ) )
    2022/// [ array_iterator begin, array_iterator end ] get_iterators( array_type );
     23
     24
     25// A bounded array can be iterated over by using a pointer to the element type. These functions
     26// return iterators corresponding to the first element and the one-past-the-end element, STL-style.
    2127forall( type array_type, type elt_type | bounded_array( array_type, elt_type ) )
    22 elt_type *get_begin( array_type );
     28elt_type *begin( array_type );
     29
    2330forall( type array_type, type elt_type | bounded_array( array_type, elt_type ) )
    24 elt_type *get_end( array_type );
     31elt_type *end( array_type );
    2532
    26 #endif /* #ifndef ARRAY_H */
     33#endif // ARRAY_H
Note: See TracChangeset for help on using the changeset viewer.