I have such unordered map:
static std::unordered_map<std::pair<size_t , size_t>, long> my_map;
Then I want to get value from my_map
:
size_t size1 = 1;
size_t size2 = 2;
auto x = make_pair(size1, size2);
auto &result = my_map[x];
But I have an error:
error: no match for ‘operator[]’ (operand types are ‘std::unordered_map<std::pair<long unsigned int, long unsigned int>, long int>’ and ‘std::pair<long unsigned int, long unsigned int>’)
auto &result = my_map[x];
How can I overcome it?