ADTaaron-thesisarm-ehast-experimentalcleanup-dtorsctordeferred_resndemanglerenumforall-pointer-decayjacob/cs343-translationjenkins-sandboxmemorynew-astnew-ast-unique-exprnew-envno_listpersistent-indexerpthread-emulationqualifiedEnumresolv-newwith_gc
Last change
on this file since f48ed47 was
ea29e73,
checked in by Thierry Delisle <tdelisle@…>, 8 years ago
|
adding a generic vector implementation to libcfa
|
-
Property mode set to
100644
|
File size:
432 bytes
|
Line | |
---|
1 | #include <stdlib> |
---|
2 | |
---|
3 | #include <containers/vector> |
---|
4 | |
---|
5 | int main(int argc, char const *argv[]) { |
---|
6 | vector(int) iv; |
---|
7 | |
---|
8 | push_back(&iv, 1); |
---|
9 | push_back(&iv, 2); |
---|
10 | push_back(&iv, 3); |
---|
11 | |
---|
12 | assert(!empty(&iv)); |
---|
13 | assert(size(&iv) == 3); |
---|
14 | assert(iv[0] == 1); |
---|
15 | assert(at(&iv, 0) == 1); |
---|
16 | assert(iv[1] == 2); |
---|
17 | assert(at(&iv, 1) == 2); |
---|
18 | assert(iv[2] == 3); |
---|
19 | assert(at(&iv, 2) == 3); |
---|
20 | |
---|
21 | clear(&iv); |
---|
22 | |
---|
23 | assert(empty(&iv)); |
---|
24 | assert(size(&iv) == 0); |
---|
25 | |
---|
26 | return 0; |
---|
27 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.