Well, I don't believe you can sort a 2D array using the sort function from algorithm... what you could do is make a function to do just that instead. Preferably keep it in a library in case it is ever needed, and under a namespace just in case it ever comes up in any libraries you download elsewhere. Something like that would actually be rather useful... In which way are you sorting the 2D array, anyway? Sorting it as one giant 1D array, where after each row you simply go down to the next and start from the far left again?