#ifndef ARRAY_H #define ARRAY_H //#include "iterator.h" // An array has contiguous elements accessible in any order using integer indicies. The first // element has index 0. context array( type array_type, type elt_type ) { lvalue elt_type ?[?]( array_type, int ); }; // A bounded array is an array that carries its maximum index with it. context bounded_array( type array_type, type elt_type | array( array_type, elt_type ) ) { int last( array_type ); }; // implement iterator_for typedef int array_iterator; /// forall( type array_type, elt_type | bounded_array( array_type, elt_type ) ) /// [ array_iterator begin, array_iterator end ] get_iterators( array_type ); // A bounded array can be iterated over by using a pointer to the element type. These functions // return iterators corresponding to the first element and the one-past-the-end element, STL-style. forall( type array_type, type elt_type | bounded_array( array_type, elt_type ) ) elt_type *begin( array_type ); forall( type array_type, type elt_type | bounded_array( array_type, elt_type ) ) elt_type *end( array_type ); #endif // ARRAY_H