Changes in src/examples/array.h [4040425:d3b7937]
- File:
-
- 1 edited
-
src/examples/array.h (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/examples/array.h
r4040425 rd3b7937 10 10 // Created On : Wed May 27 17:56:53 2015 11 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed Mar 2 18:13:35201613 // Update Count : 512 // Last Modified On : Tue Jan 26 17:09:29 2016 13 // Update Count : 3 14 14 // 15 15 … … 21 21 // An array has contiguous elements accessible in any order using integer indicies. The first 22 22 // element has index 0. 23 trait array( otype array_type, otype elt_type ) {23 context array( type array_type, type elt_type ) { 24 24 lvalue elt_type ?[?]( array_type, int ); 25 25 }; 26 26 27 27 // A bounded array is an array that carries its maximum index with it. 28 trait bounded_array( otype array_type, otype elt_type | array( array_type, elt_type ) ) {28 context bounded_array( type array_type, type elt_type | array( array_type, elt_type ) ) { 29 29 int last( array_type ); 30 30 }; … … 34 34 typedef int array_iterator; 35 35 36 /// forall( otype array_type, elt_type | bounded_array( array_type, elt_type ) )36 /// forall( type array_type, elt_type | bounded_array( array_type, elt_type ) ) 37 37 /// [ array_iterator begin, array_iterator end ] get_iterators( array_type ); 38 38 … … 40 40 // A bounded array can be iterated over by using a pointer to the element type. These functions 41 41 // return iterators corresponding to the first element and the one-past-the-end element, STL-style. 42 forall( otype array_type, otype elt_type | bounded_array( array_type, elt_type ) )42 forall( type array_type, type elt_type | bounded_array( array_type, elt_type ) ) 43 43 elt_type *begin( array_type ); 44 44 45 forall( otype array_type, otype elt_type | bounded_array( array_type, elt_type ) )45 forall( type array_type, type elt_type | bounded_array( array_type, elt_type ) ) 46 46 elt_type *end( array_type ); 47 47
Note:
See TracChangeset
for help on using the changeset viewer.