Function IntrusivePtr.toHash

Generate hash

size_t toHash() const pure nothrow @nogc @property scope @trusted;

Return

Address of payload as size_t

Examples

static struct Foo{
    ControlBlock!(int, int) c;
    int i;

    this(int i)pure nothrow @safe @nogc{
        this.i = i;
    }
}

{
    IntrusivePtr!Foo x = IntrusivePtr!Foo.make(123);
    IntrusivePtr!Foo y = IntrusivePtr!Foo.make(123);
    assert(x.toHash == x.toHash);
    assert(y.toHash == y.toHash);
    assert(x.toHash != y.toHash);
    IntrusivePtr!(const Foo) z = x;
    assert(x.toHash == z.toHash);
}
{
    IntrusivePtr!Foo x;
    IntrusivePtr!(const Foo) y;
    assert(x.toHash == x.toHash);
    assert(y.toHash == y.toHash);
    assert(x.toHash == y.toHash);
}