Skip to content

Instantly share code, notes, and snippets.

@hiramekun
Created October 3, 2018 14:43
Show Gist options
  • Save hiramekun/6c7c94d5daaf9d6657b42ea8633ebe0c to your computer and use it in GitHub Desktop.
Save hiramekun/6c7c94d5daaf9d6657b42ea8633ebe0c to your computer and use it in GitHub Desktop.
mapをvectorに変換して,それをvalueの値でsortする
unordered_map<int, int> mp_even;
vector<pair<int, int> > elem_even(mp_even.begin(), mp_even.end());
sort(elem_even.begin(), elem_even.end(),
[](pair<int, int> a, pair<int, int> b) { return a.second > b.second; });
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment