#include "stdafx.h"
#include <unordered_map>
#include <iostream>
using namespace std;
typedef tr1::unordered_map<int, int>MyMap ;
int _tmain(int argc, _TCHAR* argv[])
{
MyMap PolicyMap;
PolicyMap.insert(Myap::value_type(0, 10));
PolicyMap.insert(Myap::value_type(1, 20));
PolicyMap.insert(Myap::value_type(2, 30));
for (Myap::const_iterator i = PolicyMap.begin(); i != PolicyMap.end() ; i++)
{
cout << " [" << i->first << ", " << i->second << "]" << endl;
}
return 0;
}
上記のコードの出力が[0、10]、[2、30]、[1、20]である理由。[2、30]、[1、20]、[0、10]である必要があります。ゼロからキー値を入力し始めた場合にのみ発生します。助けてください