#include <assert.h>
#include <stdint.h>
#include <stdio.h>
#include <derive-c/structures/staticvec/template.h>
Go to the source code of this file.
◆ INPLACE_CAPACITY
◆ MAX_CAPACITY
◆ SELF
#define SELF staticvec_chars |
◆ iter_example()
- Examples
- structures/staticvec.c.
Definition at line 39 of file staticvec.c.
39 {
40 staticvec_chars vec = staticvec_chars_new();
41
42
44 staticvec_chars_push(&vec, 'a' + i);
45 }
46
47
48 staticvec_chars_iter_const iter = staticvec_chars_get_iter_const(&vec);
49 unsigned char const* item = NULL;
50 while (item = staticvec_chars_iter_const_next(&iter), item != NULL) {
51 printf("%u ", *item);
52 }
53 printf("\n");
54
55 staticvec_chars_delete(&vec);
56}
◆ main()
◆ push_example()
- Examples
- structures/staticvec.c.
Definition at line 16 of file staticvec.c.
16 {
17 staticvec_chars vec = staticvec_chars_new();
18
19
21 staticvec_chars_push(&vec, i);
22 }
23
24
25 assert(!staticvec_chars_try_push(&vec, 8));
26
27
29 assert(*staticvec_chars_read(&vec, i) == i);
30 }
31
32
33 assert(staticvec_chars_try_read(&vec,
MAX_CAPACITY) == NULL);
34 assert(staticvec_chars_try_read(&vec,
MAX_CAPACITY + 1) == NULL);
35
36 staticvec_chars_delete(&vec);
37}