#include <iostream>
#include <map>
#include <vector>
#include <string>
struct ClassA {
int val;
ClassA(int v) : val(v) {}
};
bool operator<(const ClassA& lhs, const ClassA& rhs) { return lhs.val < rhs.val; }
ClassA key1(1);
ClassA key2(2);
ClassA key3(3);
std::map<ClassA, std::vector<std::pair<std::string, std::string>>> stringMap;
void functionA()
{
// no point
}
void functionB()
{
stringMap[key1].push_back(std::make_pair("foo", "bar"));
stringMap[key1].push_back(std::make_pair("baz", "xyzzy"));
stringMap[key2].push_back(std::make_pair("one", "two"));
stringMap[key3].push_back(std::make_pair("one", "two"));
}
void functionC()
{
stringMap.clear();
}
int main()
{
functionB();
for(auto& v: stringMap)
{
std::cout << v.first.val << " => {";
for(auto& p: v.second)
std::cout << " '" << p.first << "','" << p.second << "' ";
std::cout << "}\n";
}
functionC();
}
I2luY2x1ZGUgPGlvc3RyZWFtPgojaW5jbHVkZSA8bWFwPgojaW5jbHVkZSA8dmVjdG9yPgojaW5jbHVkZSA8c3RyaW5nPgoKc3RydWN0IENsYXNzQSB7CiAgICBpbnQgdmFsOwogICAgQ2xhc3NBKGludCB2KSA6IHZhbCh2KSB7fQp9Owpib29sIG9wZXJhdG9yPChjb25zdCBDbGFzc0EmIGxocywgY29uc3QgQ2xhc3NBJiByaHMpIHsgcmV0dXJuIGxocy52YWwgPCByaHMudmFsOyB9CgpDbGFzc0Ega2V5MSgxKTsKQ2xhc3NBIGtleTIoMik7CkNsYXNzQSBrZXkzKDMpOwoKc3RkOjptYXA8Q2xhc3NBLCBzdGQ6OnZlY3RvcjxzdGQ6OnBhaXI8c3RkOjpzdHJpbmcsIHN0ZDo6c3RyaW5nPj4+IHN0cmluZ01hcDsKCnZvaWQgZnVuY3Rpb25BKCkKewogICAgLy8gbm8gcG9pbnQKfQoKdm9pZCBmdW5jdGlvbkIoKQp7CiAgICBzdHJpbmdNYXBba2V5MV0ucHVzaF9iYWNrKHN0ZDo6bWFrZV9wYWlyKCJmb28iLCAiYmFyIikpOwogICAgc3RyaW5nT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