quick sort template in cpp