How to create a unordered map of a pair and triplet?

#include<bits/stdc++.h>
using namespace std;
int main()
{
unordered_map<pair<int,int>,pair<int,pair<int,int>>>umap;
for(int i=0;i<5;i++)
{
umap.insert(make_pair(make_pair(i,i),make_pair(i,make_pair(i,i)));
}
unordered_map<pair<int,int>,pair<int,pair<int,int>>>::iterator it;
it = umap.begin();
while(it != umap.end())
{
cout<first.first<<" “<first.second<<” “<second.first<<” “<second.second.first<<” “<second.second.second<<”\n";
it++;
}
}

this is not working…but i m unable to figure out the reason… ?

“this is not working” is not helpful, but see this.

Edit:

You also seem to be missing a closing bracket on this line:

umap.insert(make_pair(make_pair(i,i),make_pair(i,make_pair(i,i)));

1 Like

Maybe You Can See This How to create an unordered_map of pairs in C++? - GeeksforGeeks For Help, Tutorial

1 Like

Using tuple makes it easier

unordered_map<pair<int,int>,tuple<int,int,int>>mp;
1 Like