/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include <iostream>
#include <unordered_map>
int main()
{
std::cout << "Hello World" << std::endl;
struct MyComparator {
bool operator()(const std::string& lhs, const std::string& rhs) const
{
std::cout << "COMPARE!!!" << std::endl;
return lhs + 'a' == rhs;
}
};
std::unordered_map<std::string, int, std::hash<std::string>, MyComparator>
some_odd_map = { { "a", 1 }, { "b", 2 }, { "c", 3 } };
auto el = some_odd_map.find("aa");
if (el != some_odd_map.end()) {
std::cout << "Found: " << el->second << std::endl;
}
return 0;
}