Two-dimension unordered_map in C++

50 views Asked by At

Im new in C++, I figured out how to use 1 dimensional unordered map:

unordered_map<string, int> dictionary;
dictionary[word]++;//Simple adding word to dictionary and increasing count of that word.

In python I could do 2-dimensional boolean hash-table simple with:

cache ={}
cache([5,11])=true
cache([100,1])=false
//And then i can work with hash-table:
if ([i,j]) in cache:
    retrun cache([i,j])

Could you help me, how does it works in C++?

I want to make two-dimensional hash table like that:

unordered_map<int, int, bool> dictionary;
dictionary[1][3] = true; dictionary[7][5] = false;
if (dictionary.find([i][j]) != dict_reference.end())
{//Pair in dictionary
}

It ofc dont work in C++.

0

There are 0 answers