Merge remote-tracking branch 'n8sh/relax-hasher-reqs'
This commit is contained in:
commit
4653e94fa1
@ -154,7 +154,7 @@ struct Range(T)
|
|||||||
* hasher = Hash function for $(D_PARAM T).
|
* hasher = Hash function for $(D_PARAM T).
|
||||||
*/
|
*/
|
||||||
struct Set(T, alias hasher = hash)
|
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 HashArray = .HashArray!(hasher, T);
|
||||||
private alias Buckets = HashArray.Buckets;
|
private alias Buckets = HashArray.Buckets;
|
||||||
@ -767,3 +767,9 @@ if (is(typeof(hasher(T.init)) == size_t))
|
|||||||
}
|
}
|
||||||
testFunc(set);
|
testFunc(set);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@nogc nothrow pure @safe unittest
|
||||||
|
{
|
||||||
|
// Using hasher that takes argument by ref.
|
||||||
|
Set!(int, (const ref x) => cast(size_t)x) set;
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user