Index: src/tests/vector/array.c
===================================================================
--- src/tests/vector/array.c	(revision 1c31f681ccd8499a1803e510a302bdfd289ce990)
+++ src/tests/vector/array.c	(revision 1c31f681ccd8499a1803e510a302bdfd289ce990)
@@ -0,0 +1,41 @@
+//
+// 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.c --
+//
+// Author           : Richard C. Bilson
+// Created On       : Wed May 27 17:56:53 2015
+// Last Modified By : Rob Schluntz
+// Last Modified On : Wed Apr 27 17:21:52 2016
+// Update Count     : 3
+//
+
+#include "array.h"
+
+/// forall( otype array_type, elt_type | bounded_array( array_type, elt_type ) )
+/// [ array_iterator begin, array_iterator end ]
+/// get_iterators( array_type array )
+/// {
+///   begin = 0;
+///   end = last( array );
+/// }
+
+// The first element is always at index 0.
+forall( otype array_type, otype elt_type | bounded_array( array_type, elt_type ) )
+elt_type * begin( array_type * array ) {
+	return &array[ 0 ];
+}
+
+// The end iterator should point one past the last element.
+forall( otype array_type, otype elt_type | bounded_array( array_type, elt_type ) )
+elt_type * end( array_type * array ) {
+	return &array[ last( array ) ] + 1;
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa array.c" //
+// End: //
Index: src/tests/vector/array.h
===================================================================
--- src/tests/vector/array.h	(revision 1c31f681ccd8499a1803e510a302bdfd289ce990)
+++ src/tests/vector/array.h	(revision 1c31f681ccd8499a1803e510a302bdfd289ce990)
@@ -0,0 +1,54 @@
+//
+// 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 : Rob Schluntz
+// Last Modified On : Wed Apr 27 17:26:04 2016
+// Update Count     : 5
+//
+
+#ifndef ARRAY_H
+#define ARRAY_H
+
+//#include <iterator>
+
+// An array has contiguous elements accessible in any order using integer indicies. The first
+// element has index 0.
+trait array( otype array_type, otype elt_type ) {
+	lvalue elt_type ?[?]( array_type, int );
+};
+
+// A bounded array is an array that carries its maximum index with it.
+trait bounded_array( otype array_type, otype elt_type | array( array_type *, elt_type ) ) {
+	int last( array_type * );
+};
+
+// implement iterator_for
+
+typedef int array_iterator;
+
+/// forall( otype 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( otype array_type, otype elt_type | bounded_array( array_type, elt_type ) )
+elt_type * begin( array_type * array );
+
+// The end iterator should point one past the last element.
+forall( otype array_type, otype elt_type | bounded_array( array_type, elt_type ) )
+elt_type * end( array_type * array );
+
+#endif // ARRAY_H
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa array.c" //
+// End: //
Index: src/tests/vector/vector_int.c
===================================================================
--- src/tests/vector/vector_int.c	(revision 1c31f681ccd8499a1803e510a302bdfd289ce990)
+++ src/tests/vector/vector_int.c	(revision 1c31f681ccd8499a1803e510a302bdfd289ce990)
@@ -0,0 +1,77 @@
+//
+// 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.
+//
+// vector_int.c --
+//
+// Author           : Richard C. Bilson
+// Created On       : Wed May 27 17:56:53 2015
+// Last Modified By : Rob Schluntz
+// Last Modified On : Wed Apr 27 17:27:12 2016
+// Update Count     : 3
+//
+
+#include "vector_int.h"
+extern "C" {
+#include <stdlib.h>
+#include <assert.h>
+}
+
+#define DEFAULT_CAPACITY 20
+
+void ?{}( vector_int * vec ) {
+	vec { DEFAULT_CAPACITY };
+}
+
+void ?{}( vector_int * vec, int reserve ) {
+	vec->last = -1;
+	vec->capacity = reserve;
+	vec->data = malloc( sizeof( int ) * reserve );
+}
+
+void ?{}( vector_int * vec, vector_int other ) {
+	vec->last = other.last;
+	vec->capacity = other.capacity;
+	vec->data = malloc( sizeof( int ) * other.capacity );
+	for (int i = 0; i < vec->last; i++) {
+		vec->data[i] = other.data[i];
+	}
+}
+
+void ^?{}( vector_int * vec ) {
+	free( vec->data );
+}
+
+void reserve( vector_int *vec, int reserve ) {
+	if ( reserve > vec->capacity ) {
+		vec->data = realloc( vec->data, sizeof( int ) * reserve );
+		vec->capacity = reserve;
+	}
+}
+
+void append( vector_int *vec, int element ) {
+	vec->last++;
+	if ( vec->last == vec->capacity ) {
+		vec->capacity *= 2;
+		vec->data = realloc( vec->data, sizeof( int ) * vec->capacity );
+	}
+	vec->data[ vec->last ] = element;
+}
+
+// implement bounded_array
+
+lvalue int ?[?]( vector_int * vec, int index ) {
+	return vec->data[ index ];
+}
+
+int last( vector_int * vec ) {
+	return vec->last;
+}
+
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa vector_int.c" //
+// End: //
Index: src/tests/vector/vector_int.h
===================================================================
--- src/tests/vector/vector_int.h	(revision 1c31f681ccd8499a1803e510a302bdfd289ce990)
+++ src/tests/vector/vector_int.h	(revision 1c31f681ccd8499a1803e510a302bdfd289ce990)
@@ -0,0 +1,45 @@
+//
+// 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.
+//
+// vector_int.h --
+//
+// Author           : Richard C. Bilson
+// Created On       : Wed May 27 17:56:53 2015
+// Last Modified By : Rob Schluntz
+// Last Modified On : Wed Apr 27 17:26:59 2016
+// Update Count     : 2
+//
+
+#ifndef VECTOR_INT_H
+#define VECTOR_INT_H
+
+// A flexible array, similar to a C++ vector, that holds integers and can be resized dynamically
+
+typedef struct vector_int {
+	int last;											// last used index
+	int capacity;										// last possible index before reallocation
+	int *data;											// array
+} vector_int;
+
+void ?{}( vector_int * );								// allocate vector with default capacity
+void ?{}( vector_int *, int reserve );          // allocate vector with specified capacity
+void ?{}( vector_int * vec, vector_int other ); // copy constructor
+void ^?{}( vector_int * );								// deallocate vector's storage
+
+void reserve( vector_int *vec, int reserve );			// reserve more capacity
+void append( vector_int *vec, int element );			// add element to end of vector, resizing as necessary
+
+// implement bounded_array
+
+lvalue int ?[?]( vector_int * vec, int index );			// access to arbitrary element (does not resize)
+int last( vector_int * vec );								// return last element
+
+#endif // VECTOR_INT_H
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa vector_int.c" //
+// End: //
Index: src/tests/vector/vector_test.c
===================================================================
--- src/tests/vector/vector_test.c	(revision 1c31f681ccd8499a1803e510a302bdfd289ce990)
+++ src/tests/vector/vector_test.c	(revision 1c31f681ccd8499a1803e510a302bdfd289ce990)
@@ -0,0 +1,47 @@
+//
+// 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.
+//
+// vector_test.c --
+//
+// Author           : Richard C. Bilson
+// Created On       : Wed May 27 17:56:53 2015
+// Last Modified By : Rob Schluntz
+// Last Modified On : Wed Apr 27 17:31:27 2016
+// Update Count     : 18
+//
+
+#include <fstream>
+#include <iterator>
+#include "vector_int.h"
+#include "array.h"
+
+int main( void ) {
+	vector_int vec;
+
+	// read in numbers until EOF or error
+	int num;
+
+	sout | "enter N elements and C-d on a separate line:" | endl;
+	for ( ;; ) {
+		sin | &num;
+	  if ( fail( sin ) || eof( sin ) ) break;
+		append( &vec, num );
+	}
+	// write out the numbers
+
+	sout | "Array elements:" | endl;
+	write( begin( &vec ), end( &vec ), sout );
+	sout | endl;
+
+	sout | "Array elements reversed:" | endl;
+	write_reverse( begin( &vec ), end( &vec ), sout );
+	sout | endl;
+}
+
+// Local Variables: //
+// tab-width: 4 //
+// compile-command: "cfa vector_test.c vector_int.o array.o" //
+// End: //
