#include <iostream>
#include <string>
#include <unordered_map>
using namespace std;
int main()
{
unordered_map< int, string > m;
m[1] = "one";
m[2] = "two";
m[4] = "four";
m[3] = "three";
m[2] = "TWO!";
cout << m[2] << endl;
m.clear();
return 0;
}
I am learning and can’t figure it out. The compiler throws the error that type unordered_map is undeclared.
I am using Visual C++ 2008 Express Edition.
In Visual Studio 2008 the classes in Technical Report 1 (TR1) are in namespace std::tr1.
Add:
to your code.