map容器按值(value)排序

衆所周知,map映射是(key-value)的形式,map自帶爲key排序,可是不少時候咱們想讓map按value排序,這時,咱們能夠藉助vectorweb bool cmp(const PAIR& x, const PAIR& y) { return x.second > y.second //降序 } typedef pair<string, int> PAIR map<string, i
相關文章
相關標籤/搜索