64,646
社区成员
发帖
与我相关
我的任务
分享
#include<iostream>
#include<map>
#include<iterator>
#include<Windows.h>
#include<string>
using namespace std;
struct ptrCmp{
bool operator()( const char * s1, const char * s2 ) const
{
return strcmp( s1, s2 ) < 0;
}
};
struct Cstring_less{
bool operator()(const char* p,const char* q) const
{
return strcmp(p,q)<0;
}
};
void f(map<char*,int,Cstring_less>&m,multimap<char*,int,Cstring_less>&mm)
{
m.insert(make_pair("x",4));
m.insert(make_pair("x",5));
mm.insert(make_pair("x",4));
mm.insert(make_pair("x",5));
}
int main()
{
map<char*,int,Cstring_less>m;
multimap<char*,int,Cstring_less>mm;
f(m,mm);
map<char *, int, ptrCmp> mapStr;
mapStr.insert(make_pair("abc",1));
system("PAUSE");
return 0;
}
map<const char*,int,Cstring_less>m;
multimap<const char*,int,Cstring_less>mm;