ADT
aaron-thesis
arm-eh
ast-experimental
cleanup-dtors
deferred_resn
demangler
enum
forall-pointer-decay
jacob/cs343-translation
jenkins-sandbox
new-ast
new-ast-unique-expr
new-env
no_list
persistent-indexer
pthread-emulation
qualifiedEnum
resolv-new
with_gc
Last change
on this file since ac74057 was 9236060, checked in by Rob Schluntz <rschlunt@…>, 8 years ago |
Merge branch 'master' into references
|
-
Property mode
set to
100644
|
File size:
1.4 KB
|
Rev | Line | |
---|
[86bd7c1f] | 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 | //
|
---|
[eab39cd] | 7 | // vector_int.h --
|
---|
[86bd7c1f] | 8 | //
|
---|
| 9 | // Author : Richard C. Bilson
|
---|
| 10 | // Created On : Wed May 27 17:56:53 2015
|
---|
[6b0b624] | 11 | // Last Modified By : Peter A. Buhr
|
---|
| 12 | // Last Modified On : Sat Jul 22 10:04:02 2017
|
---|
| 13 | // Update Count : 4
|
---|
[86bd7c1f] | 14 | //
|
---|
| 15 |
|
---|
[6b0b624] | 16 | #pragma once
|
---|
[51b73452] | 17 |
|
---|
[134b86a] | 18 | // A flexible array, similar to a C++ vector, that holds integers and can be resized dynamically
|
---|
[51b73452] | 19 |
|
---|
[134b86a] | 20 | typedef struct vector_int {
|
---|
[86bd7c1f] | 21 | int last; // last used index
|
---|
| 22 | int capacity; // last possible index before reallocation
|
---|
| 23 | int *data; // array
|
---|
[134b86a] | 24 | } vector_int;
|
---|
[51b73452] | 25 |
|
---|
[2afec66] | 26 | void ?{}( vector_int & ); // allocate vector with default capacity
|
---|
[9a4e996] | 27 | void ?{}( vector_int &, int reserve ); // allocate vector with specified capacity
|
---|
[9236060] | 28 | void ?{}( vector_int & vec, vector_int other ); // copy constructor
|
---|
| 29 | void ^?{}( vector_int & ); // deallocate vector's storage
|
---|
[51b73452] | 30 |
|
---|
[86bd7c1f] | 31 | 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
|
---|
[51b73452] | 33 |
|
---|
| 34 | // implement bounded_array
|
---|
| 35 |
|
---|
[9a4e996] | 36 | int & ?[?]( vector_int * vec, int index ); // access to arbitrary element (does not resize)
|
---|
[9236060] | 37 | int last( vector_int * vec ); // return last element
|
---|
[86bd7c1f] | 38 |
|
---|
| 39 | // Local Variables: //
|
---|
| 40 | // tab-width: 4 //
|
---|
| 41 | // compile-command: "cfa vector_int.c" //
|
---|
| 42 | // End: //
|
---|
Note:
See
TracBrowser
for help on using the repository browser.