summaryrefslogtreecommitdiffhomepage
path: root/misc/examples/new_vec.c
diff options
context:
space:
mode:
Diffstat (limited to 'misc/examples/new_vec.c')
-rw-r--r--misc/examples/new_vec.c42
1 files changed, 0 insertions, 42 deletions
diff --git a/misc/examples/new_vec.c b/misc/examples/new_vec.c
deleted file mode 100644
index df443b7f..00000000
--- a/misc/examples/new_vec.c
+++ /dev/null
@@ -1,42 +0,0 @@
-#include <stdio.h>
-#include <stc/forward.h>
-
-forward_cvec(cvec_i32, int);
-forward_cvec(cvec_pnt, struct Point);
-
-struct MyStruct {
- cvec_i32 intvec;
- cvec_pnt pntvec;
-} typedef MyStruct;
-
-#define i_val int
-#define i_is_forward
-#define i_tag i32
-#include <stc/cvec.h>
-
-typedef struct Point { int x, y; } Point;
-
-#define i_val Point
-#define i_less(a, b) a->x < b->x || (a->x == b->x && a->y < b->y)
-#define i_is_forward
-#define i_tag pnt
-#include <stc/cvec.h>
-
-int main()
-{
- MyStruct my = {0};
-
- cvec_pnt_push(&my.pntvec, (Point){42, 14});
- cvec_pnt_push(&my.pntvec, (Point){32, 94});
- cvec_pnt_push(&my.pntvec, (Point){62, 81});
- cvec_pnt_push(&my.pntvec, (Point){32, 91});
-
- cvec_pnt_sort(&my.pntvec);
-
- c_foreach (i, cvec_pnt, my.pntvec)
- printf(" (%d %d)", i.ref->x, i.ref->y);
- puts("");
-
- cvec_i32_drop(&my.intvec);
- cvec_pnt_drop(&my.pntvec);
-}