- 论坛徽章:
- 0
|
#include "stdafx.h"
#include <utility>
#include <iostream>
#include <map>
#include <string>
#include <vector>
using namespace std;
struct Item
{
string name;
string cd;
Item(const string &name,const string &cd)
{
this->name=name;
this->cd=cd;
}
bool operator==( const Item & object)
{
return this->cd == object.cd;
}
bool operator<( const Item & object)
{
return this->cd < object.cd;
}
};
struct Area
{
string name;
string cd;
Area(const string &name,const string &cd)
{
this->name=name;
this->cd=cd;
}
bool operator==( const Area & object)
{
return this->cd == object.cd;
}
bool operator<( const Area & object)
{
return this->cd < object.cd;
}
};
int _tmain(int argc, _TCHAR* argv[])
{
map< Item,int > ItemPosition;
map< Area, vector<string> > ResultMap;
map< Area, vector<int> > AreaFlag;
//
vector<int> aa;
Area bb("ss","sss");
AreaFlag.insert(make_pair(bb,aa));
return 0;
}
错误提示:
1 error C2678: binary '<' : no operator found which takes a left-hand operand of type 'const Area' (or there is no acceptable conversion) d:\microsoft visual studio 8\vc\include\functional 143
请各位前辈赐教,谢谢 |
|