//
// Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
//
// The contents of this file are covered under the licence agreement in the
// file "LICENCE" distributed with Cforall.
//
// array.h -- 
//
// Author           : Richard C. Bilson
// Created On       : Wed May 27 17:56:53 2015
// Last Modified By : Peter A. Buhr
// Last Modified On : Wed May 27 18:10:32 2015
// Update Count     : 2
//

#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

// Local Variables: //
// tab-width: 4 //
// compile-command: "cfa array.c" //
// End: //
