summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorEugen Wissner <belka@caraus.de>2018-08-12 06:17:12 +0200
committerEugen Wissner <belka@caraus.de>2018-08-12 06:17:12 +0200
commit4653e94fa105eaa2a368d38963e5fecbafc0e08f (patch)
tree695d861e01b332d68f4b71ae638897dd16c5b095 /source
parentba5833318b3168685b0349aa41f487422fcb62d5 (diff)
parent22cffe9d6e094ed5a5ba4d4fb653f781efb73909 (diff)
downloadtanya-4653e94fa105eaa2a368d38963e5fecbafc0e08f.tar.gz
Merge remote-tracking branch 'n8sh/relax-hasher-reqs'
Diffstat (limited to 'source')
-rw-r--r--source/tanya/container/set.d8
1 files changed, 7 insertions, 1 deletions
diff --git a/source/tanya/container/set.d b/source/tanya/container/set.d
index bd889a1..e5dc2d6 100644
--- a/source/tanya/container/set.d
+++ b/source/tanya/container/set.d
@@ -154,7 +154,7 @@ struct Range(T)
* hasher = Hash function for $(D_PARAM T).
*/
struct Set(T, alias hasher = hash)
-if (is(typeof(hasher(T.init)) == size_t))
+if (is(typeof(((T x) => hasher(x))(T.init)) == size_t))
{
private alias HashArray = .HashArray!(hasher, T);
private alias Buckets = HashArray.Buckets;
@@ -767,3 +767,9 @@ if (is(typeof(hasher(T.init)) == size_t))
}
testFunc(set);
}
+
+@nogc nothrow pure @safe unittest
+{
+ // Using hasher that takes argument by ref.
+ Set!(int, (const ref x) => cast(size_t)x) set;
+}