Changes in src/examples/vector_int.h [86bd7c1f:843054c2]
- File:
-
- 1 edited
-
src/examples/vector_int.h (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/examples/vector_int.h
r86bd7c1f r843054c2 1 //2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo3 //4 // The contents of this file are covered under the licence agreement in the5 // file "LICENCE" distributed with Cforall.6 //7 // vector_int.h --8 //9 // Author : Richard C. Bilson10 // Created On : Wed May 27 17:56:53 201511 // Last Modified By : Peter A. Buhr12 // Last Modified On : Wed May 27 18:39:05 201513 // Update Count : 214 //15 16 1 #ifndef VECTOR_INT_H 17 2 #define VECTOR_INT_H … … 20 5 21 6 typedef struct vector_int { 22 int last;// last used index23 int capacity;// last possible index before reallocation24 int *data;// array7 int last; // last used index 8 int capacity; // last possible index before reallocation 9 int *data; // array 25 10 } vector_int; 26 11 27 vector_int vector_int_allocate(); // allocate vector with default capacity28 vector_int vector_int_allocate( int reserve ); // allocate vector with specified capacity29 void vector_int_deallocate( vector_int ); // deallocate vector's storage12 vector_int vector_int_allocate(); // allocate vector with default capacity 13 vector_int vector_int_allocate( int reserve ); // allocate vector with specified capacity 14 void vector_int_deallocate( vector_int ); // deallocate vector's storage 30 15 31 void reserve( vector_int *vec, int reserve ); // reserve more capacity32 void append( vector_int *vec, int element ); // add element to end of vector, resizing as necessary16 void reserve( vector_int *vec, int reserve ); // reserve more capacity 17 void append( vector_int *vec, int element ); // add element to end of vector, resizing as necessary 33 18 34 19 // implement bounded_array 35 20 36 lvalue int ?[?]( vector_int vec, int index ); // access to arbitrary element (does not resize)37 int last( vector_int vec ); // return last element21 lvalue int ?[?]( vector_int vec, int index ); // access to arbitrary element (does not resize) 22 int last( vector_int vec ); // return last element 38 23 39 24 #endif // VECTOR_INT_H 40 41 // Local Variables: //42 // tab-width: 4 //43 // compile-command: "cfa vector_int.c" //44 // End: //
Note:
See TracChangeset
for help on using the changeset viewer.