Unordered Map

I implemented unordered map using this code :

#include <unordered_map >
#include <iostream > 
using namespace std;

int main() 
{	
	unordered_map<string,int> unmap;

unmap["index"] = 11;
	
cout << unmap["index"];

}

But this code gives me error on DevC++

Whats wrong?

This is what you need :

#include <tr1/unordered_map >
#include <iostream > 
using namespace std;

int main() 
{	
	tr1::unordered_map<string,int> unmap;

    unmap["index"] = 11;
    	
    cout << unmap["index"];
    
}
1 Like

Unordered_map is a c++11 or c++14 feature. You need to configure Devc++ to setup for c++11 or c++14.

Folow this link to download mingw GCC and configure DevC++: https://nuwen.net/mingw.html

Thank you so much. It worked :smiley:

1 Like
//