排序例子
struct aaa
{
bool operator() (const pair<CString, CString> map1, const pair<CString, CString> map2)
{
return map1.second < map2.second;
}
};
static void JhCmds_Test()
{
// CAcModuleResourceOverride rs;
// CAddYt dlg;
// dlg.DoModal();
std::map<CString, CString> map1;
map1.insert(std::pair<CString, CString>(_T("1"), _T("2")));
map1.insert(std::pair<CString, CString>(_T("2"), _T("1")));
map1.insert(std::pair<CString, CString>(_T("4"), _T("6")));
map1.insert(std::pair<CString, CString>(_T("3"), _T("2")));
std::vector<pair<CString, CString>> vec(map1.begin(), map1.end());
sort(vec.begin(), vec.end(), aaa());
}
#include <algorithm>