quick sort with template class