ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decaygc_noraiijacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newstringwith_gc
Last change
on this file since 9df2dd5 was
134b86a,
checked in by Peter A. Buhr <pabuhr@…>, 10 years ago
|
add compiler flag to driver, update examples, fix unnamed bit fields
|
-
Property mode set to
100644
|
File size:
935 bytes
|
Line | |
---|
1 | #ifndef VECTOR_INT_H |
---|
2 | #define VECTOR_INT_H |
---|
3 | |
---|
4 | // A flexible array, similar to a C++ vector, that holds integers and can be resized dynamically |
---|
5 | |
---|
6 | typedef struct vector_int { |
---|
7 | int last; // last used index |
---|
8 | int capacity; // last possible index before reallocation |
---|
9 | int *data; // array |
---|
10 | } vector_int; |
---|
11 | |
---|
12 | 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 |
---|
15 | |
---|
16 | 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 |
---|
18 | |
---|
19 | // implement bounded_array |
---|
20 | |
---|
21 | lvalue int ?[?]( vector_int vec, int index ); // access to arbitrary element (does not resize) |
---|
22 | int last( vector_int vec ); // return last element |
---|
23 | |
---|
24 | #endif // VECTOR_INT_H |
---|
Note: See
TracBrowser
for help on using the repository browser.