Function SharedPtr.opEquals
Operator == and != . Compare pointers.
bool opEquals
(
typeof(null) nil
) const pure nothrow @nogc scope @safe;
bool opEquals(Rhs)
(
auto scope const ref Rhs rhs
) const pure nothrow @nogc scope @safe
if (isSharedPtr!Rhs && !is(Rhs == shared));
bool opEquals(Elm)
(
scope const Elm elm
) const pure nothrow @nogc scope @safe
if (is(Elm : GetElementReferenceType!(typeof(this))));
Examples
{
SharedPtr!long x = SharedPtr!long .make(0);
assert(x != null);
x = null;
assert(x == null);
}
{
SharedPtr!long x = SharedPtr!long .make(123);
SharedPtr!long y = SharedPtr!long .make(123);
assert(x == x);
assert(y == y);
assert(x != y);
}
{
SharedPtr!long x;
SharedPtr!(const long) y;
assert(x == x);
assert(y == y);
assert(x == y);
}
{
SharedPtr!long x = SharedPtr!long .make(123);
SharedPtr!long y = SharedPtr!long .make(123);
assert(x == x .element);
assert(y .element == y);
assert(x != y .element);
}