15 void reorder(std::vector<int> & order,std::function<
void(
int,
int)> swapper)
18 for(
int i=0;i<static_cast<int>(order.size());i++) {
26 int nearIndex = order[i];
27 int farIndex = order[nearIndex];
30 swapper(nearIndex,farIndex);
32 order[order[i]] = nearIndex;
void reorder(std::vector< int > &order, std::function< void(int, int)> swapper)
Using a functor, reorder an array using a order vector.