#include <iostream>
#include <map>
struct A {
int val;
A() { };
A(int val) : val(val) { };
bool operator< (const A* tmp ) const {
return val < tmp->val;
}
};
int main() {
std::map<A*,int> m;
A *a1 = new A(2);
A *a2 = new A(2);
A *a3 = new A(3);
A *a4 = new A(1);
m[a1] = 0;
m[a2] = 0;
m[a3] = 0;
m[a4] = 0;
std::cout << m.size() << std::endl;
return 0;
}
Login in to like
Login in to comment