map排序
map<vector<int>::iterator,int*>m; vector<int>vec{ 1,4,31,23,1 }; less<int>s; auto iter = vec.begin(); while (iter != vec.end()) { m[iter] = &(*iter); iter++; } sort(vec.begin(), vec.end(), s); auto mter = m.begin(); while (mter != m.end()) { cout << *mter->second << endl; mter++; }
所望隔山海