@ -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;
|
||||
|
@ -154,7 +154,7 @@ struct Range(T)
|
||||
* hasher = Hash function for $(D_PARAM T).
|
||||
*/
|
||||
struct Set(T, alias hasher = hash)
|
||||
if (is(typeof(((T x) => hasher(x))(T.init)) == size_t))
|
||||
if (isHashFunction!(hasher, T))
|
||||
{
|
||||
private alias HashArray = .HashArray!(hasher, T);
|
||||
private alias Buckets = HashArray.Buckets;
|
||||
@ -768,8 +768,8 @@ if (is(typeof(((T x) => hasher(x))(T.init)) == size_t))
|
||||
testFunc(set);
|
||||
}
|
||||
|
||||
// Hasher can take argument by ref
|
||||
@nogc nothrow pure @safe unittest
|
||||
{
|
||||
// Using hasher that takes argument by ref.
|
||||
Set!(int, (const ref x) => cast(size_t)x) set;
|
||||
static assert(is(Set!(int, (const ref x) => cast(size_t) x)));
|
||||
}
|
||||
|
Reference in New Issue
Block a user