Refactor dict, add attaching functional

This commit is contained in:
2022-08-19 19:32:52 +03:00
parent 36f03d3d23
commit 7618294078
16 changed files with 503 additions and 1291 deletions
+11 -6
View File
@@ -4,7 +4,7 @@
#include <assert.h>
#include <stdlib.h>
#include <stdio.h>
#include "../include/extra/dict.h"
#include "../include/dict.h"
typedef vtype_dict dict_t;
@@ -40,20 +40,25 @@ int main(int argc, char** argv) {
dict_t dict;
vtype_float fl = 0.0;
int a;
vtype_float b;
dict_init(&dict);
for (size_t i = 0; i < 28; ++i) {
for (vtype_int32 i = 0; i < 28; ++i) {
if (i%2) {
dict_update(&dict, (vtype_float)fl, (vtype_int32)i);
dict_update(&dict, fl, i);
} else {
dict_update(&dict, (vtype_int32)i, (vtype_float)fl);
dict_update(&dict, i, fl);
}
fl += 0.05;
}
dict_get(&dict, 14, "Get value:", print_value);
dict_pop(&dict, 0.25, "Pop value:", print_value);
a = 13;
b = 0.25;
dict_get(&dict, a, "Get value:", print_value);
dict_pop(&dict, b, "Pop value:", print_value);
dict_foreach(&dict, "Foreach loop:", print_value);