TS-3097 Improve the efficiency of qsorting non pointers by adding an
iterface that uses refs.