-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.cpp
36 lines (30 loc) · 840 Bytes
/
test.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
#include <iostream>
#include <unordered_map>
#include <utility>
typedef std::pair<std::string,std::string> pair;
struct pair_hash
{
template <class T1, class T2>
std::size_t operator() (const std::pair<T1, T2> &pair) const
{
return std::hash<T1>()(pair.first) ^ std::hash<T2>()(pair.second);
}
};
int main()
{
std::unordered_map<pair,int,pair_hash> HE_pair ;
auto map_iter = HE_pair.find(1,2);
if(map_iter != HE_pair.end()){
int flag = 0;
//the other half exist
break;
}
else{
flag = 1;
std::vector<std::pair<T_IDX,T_IDX>> tmp_pair;
tmp_pair.push_back(std::make_pair(next_v_index,v_index));
HE_pair.insert(std::make_pair(tmp_pair,i));
tmp_pair.clear();
}
return 0;
}