Turi Create
4.0
Main Page
Related Pages
Modules
+
Namespaces
Namespace List
+
Namespace Members
+
All
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
+
Functions
_
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
+
Variables
c
d
f
g
m
s
Typedefs
Enumerations
+
Classes
Class List
Class Index
Class Hierarchy
+
Class Members
+
All
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
z
~
+
Functions
_
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
u
v
w
x
~
+
Variables
a
b
c
d
e
f
g
h
i
k
l
m
n
o
p
q
r
s
t
u
v
w
z
Typedefs
Enumerations
Enumerator
Related Functions
+
Files
File List
+
File Members
All
Functions
Macros
Examples
•
All
Classes
Namespaces
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
Modules
Pages
city_hasher.hh
1
#ifndef _CITY_HASHER_HH
2
#define _CITY_HASHER_HH
3
4
#include <city.h>
5
#include <string>
6
7
/** \ingroup util
8
* \addtogroup Hashing
9
* CityHasher is a std::hash-style wrapper around CityHash. We
10
* encourage using CityHasher instead of the default std::hash if
11
* possible. */
12
template
<
class
Key>
13
class
CityHasher {
14
public
:
15
size_t
operator()(
const
Key& k)
const
{
16
return
CityHash64((
const
char
*) &k,
sizeof
(k));
17
}
18
};
19
20
/** \ingroup util
21
* \addtogroup Hashing
22
* This is a template specialization of CityHasher for
23
* std::string. */
24
template
<>
25
class
CityHasher<
std
::string> {
26
public
:
27
size_t
operator()(
const
std::string& k)
const
{
28
return
CityHash64(k.c_str(), k.size());
29
}
30
};
31
32
#endif // _CITY_HASHER_HH
std
STL namespace.
core
util
city_hasher.hh
Generated by
1.8.13