Refactor set, add attaching functional
This commit is contained in:
+7
-3
@@ -3,7 +3,7 @@
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdio.h>
|
||||
#include "../include/extra/set.h"
|
||||
#include "../include/set.h"
|
||||
|
||||
typedef vtype_set vset_t;
|
||||
|
||||
@@ -22,6 +22,7 @@ int print_value(const void* value, vtype type, void* data) {
|
||||
int main(int argc, char** argv) {
|
||||
|
||||
vset_t set;
|
||||
int a, b;
|
||||
|
||||
vset_init(&set, VTYPE_INT32);
|
||||
|
||||
@@ -29,8 +30,11 @@ int main(int argc, char** argv) {
|
||||
vset_push(&set, i);
|
||||
}
|
||||
|
||||
vset_get(&set, 13, "Get value:", print_value);
|
||||
vset_pop(&set, 18, "Pop value:", print_value);
|
||||
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);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user