Re: Absent's Code Thread / Tech Blog
In order to avoid the template issues we had, my professor fucking included .cpp files instead of putting everything in headers. Fuck. I had forgotten about that...
Make sure you do
at the end of the heap destructor to delete the array itself.
The ArrayObject class should be easy, just store the KEYTYPE and VALTYPE. It will use a copy constructor to store the passed-in objects (if objects) into the ArrayObject class, because you're not using pointers and references to pass them in.
for writing if not empty, it'd be if (!isEmpty()) or if (isEmpty() == false), and you need braces.
Why is amount a const int in the heap class? And initialized? You could make it const int and initialize it with an initialization list.
For getting the maximum size, you'd just store the maxSize variable passed in on the constructor, on a private instance variable... the amount variable would make sense. like, putting : amount(maxSize) on the constructor. but rename amount to maxSize.
Last used seems like it'd also be a private instance variable.
lines 95 and 96 should be made into
if (heap[current]< heap[LargestChild]) swap(current, largestChild);
ugh, this shit is so slow. I should get a new vps, but then it'd cost money :|