+ _free(table);
+ }
+
+ /** Override: new operator */
+ void * operator new(size_t size) {
+ return _malloc(size);
+ }
+
+ /** Override: delete operator */
+ void operator delete(void *p, size_t size) {
+ _free(p);
+ }
+
+ /** Override: new[] operator */
+ void * operator new[](size_t size) {
+ return _malloc(size);
+ }
+
+ /** Override: delete[] operator */
+ void operator delete[](void *p, size_t size) {
+ _free(p);
+ }
+
+ /** Reset the table to its initial state. */
+ void reset() {
+ for(unsigned int i=0;i<capacity;i++) {
+ struct hashlistnode<_Key,_Val, _malloc, _calloc, _free> * bin = table[i];
+ while(bin!=NULL) {
+ struct hashlistnode<_Key,_Val, _malloc, _calloc, _free> * next=bin->next;
+ delete bin;
+ bin=next;
+ }
+ }
+ memset(table, 0, capacity*sizeof(struct hashlistnode<_Key, _Val, _malloc, _calloc, _free> *));
+ size=0;
+ }
+
+ /** Put a key value pair into the table. */
+ void put(_Key key, _Val val) {
+ if (size > threshold)
+ resize(capacity << 1);
+
+ struct hashlistnode<_Key,_Val, _malloc, _calloc, _free> *ptr = table[(((_KeyInt)key) & mask)>>_Shift];
+ struct hashlistnode<_Key,_Val, _malloc, _calloc, _free> *search = ptr;