summaryrefslogtreecommitdiffhomepage
path: root/examples
diff options
context:
space:
mode:
authorTyge Løvset <[email protected]>2020-07-21 22:33:17 +0200
committerTyge Løvset <[email protected]>2020-07-21 22:33:17 +0200
commit4724135f988ef5de088dbf4594451643aaec2bdf (patch)
tree7e1c7b92e99ac154f1de6920899c36072c820503 /examples
parent5fc073318a697b1b67b0102ab2df12395f1f9f05 (diff)
downloadSTC-modified-4724135f988ef5de088dbf4594451643aaec2bdf.tar.gz
STC-modified-4724135f988ef5de088dbf4594451643aaec2bdf.zip
1. Added initializers for containers *_from(). 2. Changed reserve(): size now means how many there actually can be filled with.
Diffstat (limited to 'examples')
-rw-r--r--examples/list.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/examples/list.c b/examples/list.c
index 4fa76f81..694ec60b 100644
--- a/examples/list.c
+++ b/examples/list.c
@@ -5,7 +5,10 @@
declare_CList(ix, uint64_t);
int main() {
- CList_ix list = clist_init;
+ CList_ix list = clist_ix_from((uint64_t[]) {10, 20, 30, 40}, 4);
+ c_foreach (i, clist_ix, list) printf("%zu ", i.item->value);
+ puts("");
+
pcg32_random_t pcg = pcg32_seed(time(NULL), 0);
int n;
for (int i=0; i<10000000; ++i) // ten million