HoverRace  2.0
Hash.h
Go to the documentation of this file.
1 
2 // Hash.h
3 //
4 // Copyright (c) 2015 Michael Imamura.
5 //
6 // Licensed under GrokkSoft HoverRace SourceCode License v1.0(the "License");
7 // you may not use this file except in compliance with the License.
8 //
9 // A copy of the license should have been attached to the package from which
10 // you have taken this file. If you can not find the license you can not use
11 // this file.
12 //
13 //
14 // The author makes no representations about the suitability of
15 // this software for any purpose. It is provided "as is" "AS IS",
16 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
17 // implied.
18 //
19 // See the License for the specific language governing permissions
20 // and limitations under the License.
21 
22 #pragma once
23 
24 namespace HoverRace {
25 namespace Util {
26 
27 namespace Hash {
28 
41 template<class T>
42 inline void Combine(std::size_t &seed, const T &v)
43 {
44  std::hash<T> hasher;
45  seed ^= hasher(v) + 0x9e3779b9 + (seed << 6) + (seed >> 2);
46 }
47 
48 } // namespace Hash
49 
50 } // namespace Util
51 } // namespace HoverRace
void Combine(std::size_t &seed, const T &v)
Mix in a value into a hash.
Definition: Hash.h:42
Definition: Announcement.h:24