]> Dogcows Code - chaz/yoink/blob - src/Moof/HashTools.hh
more explicit constructors
[chaz/yoink] / src / Moof / HashTools.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_HASHTOOLS_HH_
13 #define _MOOF_HASHTOOLS_HH_
14
15 #include <string>
16
17 #include <stlplus/hash.hpp>
18
19
20 namespace Mf {
21
22
23 struct HashFunction
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_HASHTOOLS_HH_
44
This page took 0.032301 seconds and 4 git commands to generate.