-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathHashMap.cpp
48 lines (38 loc) · 1.05 KB
/
HashMap.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
/*
* =====================================================================================
*
* Filename: HashMap.cpp
*
* Description:
*
* Version: 1.0
* Created: 2015年12月09日 15时10分49秒
* Last Modified: 2018-01-25 17:10:59
* Revision: none
* Compiler: gcc
*
* Author: zt (),
* Organization:
*
* =====================================================================================
*/
#include <stdio.h>
#include <stdlib.h>
#include <ext/hash_map>
typedef __gnu_cxx::hash_map<int, int> hmapii_t;
int main ( int argc, char* argv[] )
{
( void ) argc;
( void ) argv;
//__gnu_cxx::hash_map<int, int> hmapii;
hmapii_t hmapii;
hmapii.insert ( std::pair<int, int> ( 1, 1 ) );
hmapii.insert ( std::pair<int, int> ( 5, 3 ) );
hmapii.insert ( std::pair<int, int> ( 7, 3 ) );
hmapii.insert ( std::pair<int, int> ( 2, 8 ) );
auto iter = hmapii.find ( 7 );
printf ( "find=%d\n", iter->second );
iter = hmapii.find ( 2 );
printf ( "find=%d\n", iter->second );
return 0;
}