📄 uthash_learn.c
字号:
#include <hash_map.h>
#include <iostream.h>
#include <string.h>
int main( )
{
using namespace std;
using namespace stdext;
hash_map <int, string> hm1;
hash_map <int, string> :: iterator hm1_Iter;
hash_map <int, string> :: const_iterator hm1_cIter;
typedef pair <int, string> Int_Pair;
hm1.insert ( Int_Pair ( 0, "令狐冲" ) );
hm1.insert ( Int_Pair ( 1, "东方不败" ) );
hm1.insert ( Int_Pair ( 2, "任我行" ) );
hm1_cIter = hm1.begin ( );
cout << "The first element of hm1 is "
<< hm1_cIter -> first << "." << endl;
hm1_Iter = hm1.begin ( );
hm1.erase ( hm1_Iter );
// The following 2 lines would err because the iterator is const
// hm1_cIter = hm1.begin ( );
// hm1.erase ( hm1_cIter );
hm1_cIter = hm1.begin( );
cout << "The first element of hm1 is now "
<< hm1_cIter -> first << "." << endl;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -