5 void reorder(std::vector<int> & order,std::function<
void(
int,
int)> swapper)
8 for(
int i=0;i<static_cast<int>(order.size());i++) {
16 int nearIndex = order[i];
17 int farIndex = order[nearIndex];
20 swapper(nearIndex,farIndex);
22 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.