I am trying to write a sort function which sorts the elements in a 3 dimensional vector based on the 3rd element of the 3rd component. For example.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18
for (int z=0; z< vect.size(); z++){
for (int y=0; y< vect[z].size(); y++){
for (int i=0; i<=y; i++){
if (vect[z][y][3] > vect[z][i][3]){
vect[z].insert(i,vect[z][y]);
vect[z].erase(y);
}
}
}
}
The above code does not work because the insert and erase functions do not work. I cannot think of a better way to insert vectors into the y dimension of my vector. Any ideas?