Introduce hash.lookup.isHashFunction trait

Fix #66.
This commit is contained in:
2018-09-14 15:16:08 +02:00
parent b6d1766d58
commit b831a05407
3 changed files with 28 additions and 4 deletions

View File

@ -386,7 +386,7 @@ struct ByValue(T)
* hasher = Hash function for $(D_PARAM Key).
*/
struct HashTable(Key, Value, alias hasher = hash)
if (is(typeof(((Key k) => hasher(k))(Key.init)) == size_t))
if (isHashFunction!(hasher, Key))
{
private alias HashArray = .HashArray!(hasher, Key, Value);
private alias Buckets = HashArray.Buckets;