i want to sort a 3d vector, e.g.
3 2 1 4 5
1 2 3 4 5
5 4 3 2 1
by one row. The result when to be sorted based on the first row should be:
1 2 3 4 5
3 2 1 4 5
3 4 5 2 1
I think that is very easy by using the right compare function in std::sort, but how?
Thanks!
First of all
doesn't make up a 3d, but a 2d vector that should be defined like this
There's no intrinsic compare function provided for arbitrary
std::vector<>
's, you have to implement one, and pass it to thestd::sort()
function.