一、vector排序
vector支持cmp,就类似数组,可以直接sort。
1 #include 2 #include 3 #include 4 #include 5 #include 6 #include
二、set排序,不可以使用sort,可以直接定义的时候就设置优先级
1 #include 2 #include 3 #include 4 #include 5 #include 6 #include
> s;18 s.insert(1);19 s.insert(2);20 s.insert(3);21 s.insert(4);22 cout << "SET" << endl; 23 for(set
::iterator it = s.begin(); it != s.end(); it++) {24 cout << *it << endl;25 }26 27 }
1 #include 2 #include 3 #include 4 #include 5 #include 6 #include