forked from dyninc/OpenBFDD
-
Notifications
You must be signed in to change notification settings - Fork 0
/
hash_map.h
executable file
·53 lines (46 loc) · 1.46 KB
/
hash_map.h
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
48
49
50
51
52
53
/**************************************************************
* Copyright (c) 2010-2013, Dynamic Network Services, Inc.
* Jake Montgomery (jmontgomery@dyn.com) & Tom Daly (tom@dyn.com)
* Distributed under the FreeBSD License - see LICENSE
***************************************************************/
/**
wraps the various "standard" hash_map/unordered_map implementations.
*/
#pragma once
#include "config.h"
#ifndef HAS_UNORDERED_MAP
#error no unordered_map implementation found.
#endif
#ifdef HAS_STD_UNORDERED_MAP
#include <unordered_map>
#elif defined(HAS_TR1_UNORDERED_MAP)
#include <tr1/unordered_map>
#elif defined(HAS_EXT_HASH_MAP)
#include <ext/hash_map>
#endif
#ifdef HAS_STD_UNORDERED_MAP
template<class _Key, class _Tp,
class _Hash = std::hash<_Key>,
class _Pred = std::equal_to<_Key> >
struct hash_map
{
typedef std::unordered_map<_Key, _Tp, _Hash, _Pred> Type;
};
#elif defined(HAS_TR1_UNORDERED_MAP)
template<class _Key, class _Tp,
class _Hash = std::tr1::hash<_Key>,
class _Pred = std::equal_to<_Key> >
struct hash_map
{
typedef std::tr1::unordered_map<_Key, _Tp, _Hash, _Pred> Type;
};
#elif defined(HAS_EXT_HASH_MAP)
template<class _Key, class _Tp, class _HashFn = __gnu_cxx::hash<_Key>,
class _EqualKey = std::equal_to<_Key> >
struct hash_map
{
typedef __gnu_cxx::hash_map<_Key, _Tp, _HashFn, _EqualKey> Type;
};
#else
#error no unordered_map implementation found.
#endif