e97ee254ec140fb04fdc8542bec83e754dddc9d8
[chaz/yoink] / src / Moof / Hash.hh
1
2 /*] Copyright (c) 2009-2010, Charles McGarvey [**************************
3 **] All rights reserved.
4 *
5 * vi:ts=4 sw=4 tw=75
6 *
7 * Distributable under the terms and conditions of the 2-clause BSD license;
8 * see the file COPYING for a complete text of the license.
9 *
10 **************************************************************************/
11
12 #ifndef _MOOF_HASH_HH_
13 #define _MOOF_HASH_HH_
14
15 #include <string>
16
17 #include <stlplus/hash.hpp>
18
19
20 namespace Mf {
21
22
23 struct getHash
24 {
25 // generic hash function
26 unsigned operator()(const void* key, int len,
27 unsigned seed = -1) const;
28
29 inline unsigned operator()(const std::string& val) const
30 {
31 return (*this)(val.data(), val.length());
32 }
33
34 inline unsigned operator()(int val) const
35 {
36 return val;
37 }
38 };
39
40
41 } // namespace Mf
42
43 #endif // _MOOF_HASH_HH_
44
This page took 0.03488 seconds and 3 git commands to generate.