summaryrefslogtreecommitdiff
path: root/games/criticalmass/patches/patch-utils_FindHash.hpp
blob: 2092d1d91250359da0cd922e8b37e92f4a513200 (plain)
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
$NetBSD: patch-utils_FindHash.hpp,v 1.1 2013/06/16 20:40:40 joerg Exp $

Incomplete.

--- utils/FindHash.hpp.orig	2013-04-30 12:15:10.000000000 +0000
+++ utils/FindHash.hpp
@@ -18,9 +18,9 @@
 template< class _KeyT, class _ValT >
 _ValT* findHash( 
     _KeyT &trigger, 
-    hash_map< _KeyT, _ValT*, hash<_KeyT>, equal_to<_KeyT> > & hashMap )
+    hash_map< _KeyT, _ValT*, ::HASH_NAMESPACE::hash<_KeyT>, equal_to<_KeyT> > & hashMap )
 {
-    typename hash_map< _KeyT, _ValT*, hash<_KeyT> >::const_iterator ci;
+    typename hash_map< _KeyT, _ValT*, ::HASH_NAMESPACE::hash<_KeyT> >::const_iterator ci;
     ci = hashMap.find( trigger);
     if( ci == hashMap.end())
     {
@@ -33,9 +33,24 @@ _ValT* findHash( 
 template< class _KeyT, class _ValT >
 _ValT* findHash( 
     const _KeyT &trigger, 
-    hash_map< _KeyT, _ValT*, hash<_KeyT>, equal_to<_KeyT> > & hashMap )
+    hash_map< _KeyT, _ValT*, ::HASH_NAMESPACE::hash<_KeyT>, equal_to<_KeyT> > & hashMap )
 {
-    typename hash_map< const _KeyT, _ValT*, hash<const _KeyT> >::const_iterator ci;
+    typename hash_map< const _KeyT, _ValT*, ::HASH_NAMESPACE::hash<const _KeyT> >::const_iterator ci;
+    ci = hashMap.find( trigger);
+    if( ci == hashMap.end())
+    {
+        return 0;
+    }
+
+    return ci->second;
+}
+
+template< class _KeyT, class _ValT >
+_ValT* findHash( 
+    const _KeyT &trigger, 
+    hash_map< const _KeyT, _ValT*, ::HASH_NAMESPACE::hash<const _KeyT>, equal_to<const _KeyT> > & hashMap )
+{
+    typename hash_map< const _KeyT, _ValT*, ::HASH_NAMESPACE::hash<const _KeyT> >::const_iterator ci;
     ci = hashMap.find( trigger);
     if( ci == hashMap.end())
     {