Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

c++ Simple Class Question

Name: Anonymous 2007-06-27 0:40 ID:CjAL5fOI

I have a class called htable, when it reaches a certain size it will rehash itself. Heres the pseudo code:

/* Creates new table, and deletes old one. */
Htable Htable::htable_rehash(){
   make new Htable;
   add old values to new table;
        delete old table;
   return new Htable;
}

to call it I would say hashtable = hashtable .htable_rehash();

My question is this: do i need to free the memory in the old hash table in the class, or will it be deleted when i say table = table.rehash?

Name: Anonymous 2007-06-29 11:57 ID:7Kwp6kJ2

>>28
I've been managing my memory since I was fucking 15. Then I matured and understood it's more efficient if I do the hard tasks, such as algorithm design, and the computer does the easy, repetitive tasks, such as memory management, which is what computers exist for. That way I can do more in the same time, and if it runs slow I buy faster hardware, because hardware is less expensive than my time. Then I grew lazy (a very good programmer feature) and now I don't want to do C and C++.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List