| 468 | //////////////////////////////////////////////////////////////////////////////// |
| 469 | template<class KEY_TYPE, class VAL_TYPE, class COMPARE_OP, class CONVERTER> |
| 470 | bool cHashTable<KEY_TYPE, VAL_TYPE, COMPARE_OP, CONVERTER>::Clear(void) |
| 471 | { |
| 472 | for (int i = 0; i < mTableSize; ++i) |
| 473 | { |
| 474 | if (mTable[i] != NULL) |
| 475 | { |
| 476 | node* curr = mTable[i]; |
| 477 | node* del; |
| 478 | while (curr != NULL) |
| 479 | { |
| 480 | del = curr; |
| 481 | curr = curr->next; |
| 482 | delete del; |
| 483 | if (del == mTable[i]) |
| 484 | mTable[i] = NULL; |
| 485 | del = NULL; |
| 486 | |
| 487 | } //end delete chain loop |
| 488 | } //end if mTable[i]!= NULL |
| 489 | } //end for |
| 490 | return (IsEmpty()); |
| 491 | } |
| 492 | |
| 493 | //////////////////////////////////////////////////////////////////////////////// |
| 494 | // IsEmpty -- |