Fixed memory leak. Moved implementation details into cpp file.
Use a seperate unique_ptr buffer to hold the data for the tree,
while the tree itself does the sorting using pointers only.
This is because priority_queue only returns const references.
If I used it to store unique_ptrs I wouldn't be able to
std::move(queue.top()).