#include <iostream>
#include <vector>
#include <algorithm>
#include <unordered_set>
#include <list>

template<typename T, typename U>
void sorty(T& a, U const x){
		std::sort( a.begin(),a.end(), [&x](int i, int j)->bool { return x.at(i)>x.at(j);});
	}

int main() {

std::vector<int>toOrder(10);
std::iota(toOrder.begin(),toOrder.end(),0); 
std::vector<double> orderBy {0.2,9.8,4.0,0.01,15.1,3.3,9.01,9.11,100.1,2.03};

sorty(toOrder,orderBy);

//std::unordered_set<double> orderBy_s(orderBy.begin(),orderBy.end()); //no .at()
//std::list<int> toOrd_L(toOrder.begin(),toOrder.end()); //list
//sorty(toOrd_L,orderBy_s);

for(auto i : toOrder){
  	std::cout<<i <<"\t";
}

return 0;	
}