/* This software is licensed by the MIT License, see LICENSE file */ /* Copyright © 2022 Gregory Lirent */ #include #include #include "../include/set.h" typedef vtype_set vset_t; int print_value(vtype_variable value, void* data) { const char *n = data; vtype_int32 *v = (void*)value.pointer; assert(value.type == VTYPE_INT32); printf("%s %d\n", n, *v); return 0; } int main(int argc, char** argv) { vset_t set; int a, b; vset_init(&set, VTYPE_INT32); for (size_t i = 0; i < 28; ++i) { vset_push(&set, i); } a = 13; b = 18; vset_get(&set, a, "Get value:", print_value); vset_pop(&set, b, "Pop value:", print_value); vset_foreach(&set, "Foreach loop:", print_value); vset_free(&set); }