order by implemented using quick sort on functors