I have a vector of Moves, and a vector of scores. I would like to sort the vector of moves (based on the other vector), without creating an intermediate container. (and preferable without writing my own sort, there are already so many good). The reason I don't want an intermediate is performance reason, this portion is currently the primary bottleneck. Do someone know a neat fast hack that accomplish this? Note: making score part of Move wasn't a good idea, Move grew to much and I got loads of cache-misses that way. Also, most move-vectors wont need sorting.
struct Move { unsigned char f,t,p,m; };
std::vector<Move> mvlst;
std::vector<int> scores;
Sort mvlst
based on scores
Update: I found this, It seams to work.