I am not sure I understand why this compiles.
#include <iostream>
#include <iterator>
#include <string>
#include <unordered_map>
#include <utility>
#include <vector>
#include <unordered_set>
#include <algorithm>
#include <queue>
using namespace std;
void thing() {
auto hash = [](const std::pair<int, int> &pair) {
return std::hash<string>()(to_string(pair.first));
};
auto map = std::unordered_map<std::pair<int, int>, int, decltype(hash)>();
}
int main() {
}
I haven't passed the hash function into the constructor -- how does it know the implementation to hash a pair?