1 /** 2 * Templates for hashing types. 3 * Copyright: © 2015 Economic Modeling Specialists, Intl. 4 * Authors: Brian Schott 5 * License: $(LINK2 http://www.boost.org/LICENSE_1_0.txt, Boost License 1.0) 6 */ 7 module containers.internal.hash; 8 9 hash_t generateHash(T)(T value) nothrow @trusted 10 { 11 import std.functional : unaryFun; 12 hash_t h = typeid(T).getHash(&value); 13 h ^= (h >>> 20) ^ (h >>> 12); 14 return h ^ (h >>> 7) ^ (h >>> 4); 15 }