Changeset 86bd7c1f for src/examples/vector_int.h
- Timestamp:
- May 27, 2015, 8:33:19 PM (9 years ago)
- Branches:
- ADT, aaron-thesis, arm-eh, ast-experimental, cleanup-dtors, ctor, deferred_resn, demangler, enum, forall-pointer-decay, gc_noraii, jacob/cs343-translation, jenkins-sandbox, master, memory, new-ast, new-ast-unique-expr, new-env, no_list, persistent-indexer, pthread-emulation, qualifiedEnum, resolv-new, string, with_gc
- Children:
- 00cc023
- Parents:
- 52ac3b4
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
src/examples/vector_int.h
r52ac3b4 r86bd7c1f 1 // 2 // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo 3 // 4 // The contents of this file are covered under the licence agreement in the 5 // file "LICENCE" distributed with Cforall. 6 // 7 // vector_int.h -- 8 // 9 // Author : Richard C. Bilson 10 // Created On : Wed May 27 17:56:53 2015 11 // Last Modified By : Peter A. Buhr 12 // Last Modified On : Wed May 27 18:39:05 2015 13 // Update Count : 2 14 // 15 1 16 #ifndef VECTOR_INT_H 2 17 #define VECTOR_INT_H … … 5 20 6 21 typedef struct vector_int { 7 int last;// last used index8 int capacity;// last possible index before reallocation9 int *data;// array22 int last; // last used index 23 int capacity; // last possible index before reallocation 24 int *data; // array 10 25 } vector_int; 11 26 12 vector_int vector_int_allocate(); // allocate vector with default capacity13 vector_int vector_int_allocate( int reserve ); // allocate vector with specified capacity14 void vector_int_deallocate( vector_int ); // deallocate vector's storage27 vector_int vector_int_allocate(); // allocate vector with default capacity 28 vector_int vector_int_allocate( int reserve ); // allocate vector with specified capacity 29 void vector_int_deallocate( vector_int ); // deallocate vector's storage 15 30 16 void reserve( vector_int *vec, int reserve ); // reserve more capacity17 void append( vector_int *vec, int element ); // add element to end of vector, resizing as necessary31 void reserve( vector_int *vec, int reserve ); // reserve more capacity 32 void append( vector_int *vec, int element ); // add element to end of vector, resizing as necessary 18 33 19 34 // implement bounded_array 20 35 21 lvalue int ?[?]( vector_int vec, int index ); // access to arbitrary element (does not resize)22 int last( vector_int vec ); // return last element36 lvalue int ?[?]( vector_int vec, int index ); // access to arbitrary element (does not resize) 37 int last( vector_int vec ); // return last element 23 38 24 39 #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.