Conversation started Apr 27, 2012 at 2:36.
Apr 27, 2012 02:36
oi Moshe


Hi lapsap
@Moshe Your copy constructor looks a bit wrong. You're using the size member from the target, and copying that many items from the source. The source may have a different number of entries.
Not sure what this: Dict::Dict():capacity(MAX_CAPACITY), entries(new DictEntry[MAX_CAPACITY]),size(0){}; is supposed to be -- it doesn't even look like it should compile.
Apr 27, 2012 02:53
@JerryCoffin so we want to use getSize from the source then?
(where size says how many items there were in the source at the time of copy.)
@Moshe Sounds about right. Your code in your assignment operator looks correct. I'd probably move that into a private function and have both the assignment operator and the copy constructor use that.
Doing some more looking, your operator<< for Dictionary has UB -- it says it'll return an ostream &, but doesn't return anything.
@JerryCoffin UB?
Undefined Behavior. Anything can happen.
Ah, thanks.
Sure. Gotta go for a while.
Oh, before I go though, you also have a couple of extra semicolons. Generally harmless, but probably want to get rid of them anyway.
 
Conversation ended Apr 27, 2012 at 3:04.