#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;

vector_int vector_int_allocate();			// allocate vector with default capacity
vector_int vector_int_allocate( int reserve );		// allocate vector with specified capacity
void vector_int_deallocate( 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
