P_Set new_set(size)

- creates a new set with possible members 1..size int size;

void delete_set(set)

- deletes a set P_Set set;

void set_clear(set)

- makes set empty P_Set set;

P_Set set_copy(set)

- makes a new copy of set P_Set set;

Bool set_empty(set)

- checks whether set is empty P_Set set;

void set_add(set, elem)

- adds elem to set P_Set set; int elem;

void set_delete(set, elem)

- deletes elem from set P_Set set; int elem;

void set_assign(dest, src)

- assigns src to dest P_Set set;

void set_union(set1, set2)

- set1 becomes the union of set1 and set2 P_Set set1; P_Set set2;

void set_intersect(set1, set2)

- set1 becomes the intersection of set1 and set2 P_Set set1; P_Set set2;

void set_minus(set1, set2)

- set1 becomes set1 excluding all members of set2 P_Set set1; P_Set set2;

Bool set_member(set, elem)

- checks whether elem is a member of set P_Set set; int elem;

These functions perform the mathematical set operations. The possible elements of the set created by new_set() range from 1 to size. A set created by a call to set_copy() has the same size as the original set. For each function with two set-parameters, the assertion is made that the sizes of the sets are equal. For each function with a set and an int-parameter, the int must be within the range of the set.

void set_generator(set, func)

- performs func on each member of set P_Set set; IntFunction func;

P_Set_iterator set_iterator(set)

- returns an iterator for set P_Set set;

int set_next(it)

- returns next element of set corresponding to it P_Set_iterator it;

set_generator() traverses the entire set, i.e. every element is visited and for every element func is executed. To use set_next(), first set_iterator() must be called to initialize the iterator, then subsequent calls to set_next() return the elements of the set.

set.c set.h