Mergesort implementation in C++