摘要: 在STL中,map是按键来排序的,但很多时候需要按值来排序。一种方法是将map转化为vector,然后排序。(#add 此法缺点为 map内容没变,而是整个的传给vector了,之后所要用的是vector.或许也不能说是缺点.)另一个好的方案是 同时做一个反向的map,与之前的map,key value反过来存储.tool.h#ifndef TOOL_H#define TOOL_H#include <iostream>#include <vector>#include <map>#include <string>#include <algo 阅读全文
posted @ 2011-04-22 00:13 maxweii 阅读(1315) 评论(0) 推荐(0) 编辑