我有以下编译器错误,我该如何解决?
error: instantiated from `_Tp& std::map<_Key, _Tp, _Compare, _Alloc>::operator[](const _Key&) [with _Key = ar, _Tp = int, _Compare = std::less<ar>, _Alloc = std::allocator<std::pair<const ar, int> >]'
这是代码:
#include <map>
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <cstdlib>
using namespace std;
class ar {
public:
int a;
int b;
int c;
public:
ar() : a(0), b(0), c(0) {}
};
int main() {
map<ar, int> mapa;
ar k;
k.a = 6;
k.b = 1;
k.c = 0;
mapa[k] = 1;
//system("pause");
return 0;
}