
union DATATYPE 
{
	char   c;
	int    i;
	long   l;
	float  f;
	double d;
	void *p;
};

typedef struct
{
	IteratorGotoFunc *gotoFirst;
	IteratorGotoFunc *gotoLast;
	IteratorGotoFunc *gotoNext;
	IteratorGotoFunc *gotoPrevious;
	IteratorGotoFunc *key;
	IteratorGotoFunc *value;
	void *collection;
	void *index;

} Iterator;

void Iterator_phashGotoFirst(Iterator *self)


Iterator PHash_iterator(PHash *self)
{
	Iterator iter;
  
}

void Collection_do_(Collection *self, CollectionDoFunc *func)
{
	Iterator iterator = self->iterator(self);
	Iterator *iter = &iterator;
	
	while (Iterator_gotoNext(iter))
	{
		Value *v = Iterator_value(iter);
		func(v);
	}
}


Value *Collection_detect_(Collection *self, CollectionDetectFunc *func)
{
	Iterator iterator = self->iterator(self);
	Iterator *iter = &iterator;
	
	while (Iterator_gotoNext(iter))
	{
		Value *v = Iterator_value(iter);
		
		if (func(v)) 
		{
			return v;
		}
	}
	
	return 0x0;
}

void Collection_selectInPlace_(Collection *self, CollectionSelectFunc *func)
{
	Iterator readIterator = self->iterator(self);
	Iterator *readIter = &readIterator;

	Iterator writeIterator = self->iterator(self);
	Iterator *writeIter = &writeIterator;
	
	while (Iterator_gotoNext(readIter))
	{
		Value *v = Iterator_value(iter);
				
		if (func(v)) 
		{
			Iterator_gotoNext(writeIter);
		}
		else
		{
			
		}
	}
	
	return 0x0;
}
