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++;
    }

 

posted @ 2020-07-23 16:48  世界を変える御宅族  阅读(109)  评论(0编辑  收藏  举报