When try to run below piece of code,It compiles without any errors.
int main()
{
queue<map<int,int> >run_time;
}
But,now when I try to push something into the queue using the below code.
int main()
{
queue<map<int,int> >run_time;
run_time.push(make_pair(1,2));
run_time.push(make_pair(3,4));
}
I get error as :
no matching function for call to 'std::queue<std::map<int,int,std::less<int>,std::allocator<std::pair<const int,int>
The problem is that
make_pairdoesn’t create amap. You’ll need to create the map beforehand, insert into it withmake_pair, and insert the map itself into thequeue.