#include <iostream>
#include <map>
using namespace std;
struct myStruct {
int a;
int b;
bool operator<(const myStruct& rhs) const {
return rhs.a < this->a && rhs.b < this->b;
}
};
int main() {
std::map <myStruct, int> mymap ;
myStruct m1={1,2};
myStruct m2={2,1};
mymap.insert(make_pair(m1,3));
std::map<myStruct, int>::iterator it1 = mymap.find(m1);
std::map<myStruct, int>::iterator it2 = mymap.find(m2);
cout << it1->second << it2->second;
// here it1->second=it2->second=3, although I would have expected it2 to be equal to map.end().
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8bWFwPgp1c2luZyBuYW1lc3BhY2Ugc3RkOwogCnN0cnVjdCBteVN0cnVjdCB7CiAgaW50IGE7CiAgaW50IGI7CiAgYm9vbCBvcGVyYXRvcjwoY29uc3QgbXlTdHJ1Y3QmIHJocykgY29uc3QgewogICAgICAgICAgIHJldHVybiByaHMuYSA8IHRoaXMtPmEgJiYgcmhzLmIgPCB0aGlzLT5iOwogIH0KfTsKCgppbnQgbWFpbigpIHsKICAgICAgIHN0ZDo6bWFwICA8bXlTdHJ1Y3QsIGludD4gbXltYXAgOwogICAgICAgbXlTdHJ1Y3QgbTE9ezEsMn07CiAgICAgICBteVN0cnVjdCBtMj17MiwxfTsKICAgICAgIG15bWFwLmluc2VydChtYWtlX3BhaXIobTEsMykpOwogICAgICAgc3RkOjptYXA8bXlTdHJ1Y3QsIGludD46Oml0ZXJhdG9yIGl0MSA9IG15bWFwLmZpbmQobTEpOwogICAgICAgc3RkOjptYXA8bXlTdHJ1Y3QsIGludD46Oml0ZXJhdG9yIGl0MiA9IG15bWFwLmZpbmQobTIpOwogICAgICAgY291dCA8PCBpdDEtPnNlY29uZCA8PCBpdDItPnNlY29uZDsKICAgICAgIC8vIGhlcmUgaXQxLT5zZWNvbmQ9aXQyLT5zZWNvbmQ9MywgYWx0aG91Z2ggSSB3b3VsZCBoYXZlIGV4cGVjdGVkIGl0MiB0byBiZSBlcXVhbCB0byBtYXAuZW5kKCkuCn0=