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 3787dc1 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
|
Line | |
---|
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 : Sat Jul 22 10:04:02 2017
|
---|
13 | // Update Count : 4
|
---|
14 | //
|
---|
15 |
|
---|
16 | #pragma once
|
---|
17 |
|
---|
18 | // A flexible array, similar to a C++ vector, that holds integers and can be resized dynamically
|
---|
19 |
|
---|
20 | typedef struct vector_int {
|
---|
21 | int last; // last used index
|
---|
22 | int capacity; // last possible index before reallocation
|
---|
23 | int *data; // array
|
---|
24 | } vector_int;
|
---|
25 |
|
---|
26 | void ?{}( vector_int & ); // allocate vector with default capacity
|
---|
27 | void ?{}( vector_int &, int reserve ); // allocate vector with specified capacity
|
---|
28 | void ?{}( vector_int & vec, vector_int other ); // copy constructor
|
---|
29 | void ^?{}( vector_int & ); // deallocate vector's storage
|
---|
30 |
|
---|
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
|
---|
33 |
|
---|
34 | // implement bounded_array
|
---|
35 |
|
---|
36 | int & ?[?]( vector_int * vec, int index ); // access to arbitrary element (does not resize)
|
---|
37 | int last( vector_int * vec ); // return last element
|
---|
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.