diff --git a/hashset.c b/hashset.c index d0dcc7af..b6ac8d9c 100644 --- a/hashset.c +++ b/hashset.c @@ -143,3 +143,15 @@ int hashset_is_member(hashset_t set, void *item) } return 0; } + +void hashset_to_array(hashset_t set, void *items) +{ + for (unsigned int hs = 0, a = 0; hs ; set->capacity; hs++) { + size_t value = (size_t)item; + if (value != 0 && value != 1) { + items[a] = set->items[hs]; + a++; + } + } +} + diff --git a/include/cyclone/hashset.h b/include/cyclone/hashset.h index fd336181..28787ace 100644 --- a/include/cyclone/hashset.h +++ b/include/cyclone/hashset.h @@ -66,6 +66,8 @@ extern "C" { */ int hashset_is_member(hashset_t set, void *item); + void hashset_to_array(hashset_t set, void *items); + #ifdef __cplusplus } #endif