]> Dogcows Code - chaz/yoink/blob - src/moof/hash.hh
fixed documentation about where to find licenses
[chaz/yoink] / src / moof / hash.hh
1
2 /*] Copyright (c) 2009-2011, Charles McGarvey [*****************************
3 **] All rights reserved.
4 *
5 * Distributable under the terms and conditions of the 2-clause BSD license;
6 * see the file COPYING for a complete text of the license.
7 *
8 *****************************************************************************/
9
10 #ifndef _MOOF_HASH_HH_
11 #define _MOOF_HASH_HH_
12
13 #include <string>
14
15 #include <stlplus/containers/hash.hpp>
16
17
18 /**
19 * \file hash.hh
20 * Hash tables and functions.
21 */
22
23 namespace moof {
24
25
26 using stlplus::hash;
27
28 struct hash_function
29 {
30 // generic hash function
31 unsigned operator () (const void* key, int len, unsigned seed = -1) const;
32
33 unsigned operator () (const std::string& val) const
34 {
35 return (*this)(val.data(), val.length());
36 }
37
38 template <class T>
39 unsigned operator () (T val) const
40 {
41 return static_cast<unsigned>(val);
42 }
43 };
44
45
46 } // namespace moof
47
48 #endif // _MOOF_HASH_HH_
49
This page took 0.031828 seconds and 4 git commands to generate.