C++ implementation of quicksort