Refactor map, add attaching functional

This commit is contained in:
2022-08-19 18:46:51 +03:00
parent b789b133e2
commit 36f03d3d23
15 changed files with 353 additions and 1242 deletions
+10 -6
View File
@@ -4,7 +4,7 @@
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include "../include/extra/map.h"
#include "../include/map.h"
typedef vtype_map map_t;
@@ -34,20 +34,24 @@ int main(int argc, char** argv) {
map_t map;
vtype_float fl = 0.0;
int a, b;
map_init(&map, VTYPE_INT32);
for (size_t i = 0; i < 28; ++i) {
for (vtype_int32 i = 0; i < 28; ++i) {
if (i%2) {
map_update(&map, i, (vtype_int32)i);
map_update(&map, i, i);
} else {
map_update(&map, i, (vtype_float)fl);
map_update(&map, i, fl);
fl += 0.05;
}
}
map_get(&map, 13, "Get value:", print_value);
map_pop(&map, 18, "Pop value:", print_value);
a = 13;
b = 18;
map_get(&map, a, "Get value:", print_value);
map_pop(&map, b, "Pop value:", print_value);
map_foreach(&map, "Foreach loop:", print_value);