#include <gpk_set.h>
#include <assert.h>

int gpk_set_unsigned_hash_fcn(const unsigned& a, int n);

template <class X>
gpk_set<X>::~gpk_set()
{
 C unsigned countedc = doublehash<X,unsigned>::count();
 assert(cardinality == countedc);
}

template <class X>
gpk_set<X>::gpk_set(int nn, int (*fs)(C X&, int))
 : doublehash<X,unsigned>(nn, fs, gpk_set_unsigned_hash_fcn), cardinality(0)
{}

template <class X>
C hashitem<X, unsigned>* gpk_set<X>::set_cardinal(C X& k)
{
 C hashitem<X, unsigned>* tmp = getptr(k);
 if(!tmp)	{
	tmp = set(k, cardinality);
	cardinality++;
	}
 return tmp;
}
