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