HPCC-12290 Reimplement jarray using templates

Signed-off-by: Gavin Halliday <gavin.halliday@lexisnexis.com>
I could do - mainly because I need to go through and fix all the sort prototypes.
I nearly did it - maybe I should.