RcPtr.opCmp

Operators <, <=, >, >= for RcPtr.

Compare address of payload.

  1. sizediff_t opCmp(typeof(null) nil)
    struct RcPtr
    const @trusted scope pure nothrow @nogc
    sizediff_t
    opCmp
    (
    typeof(null) nil
    )
  2. sizediff_t opCmp(Elm elm)
  3. sizediff_t opCmp(Rhs rhs)

Examples

{
    const a = RcPtr!long.make(42);
    const b = RcPtr!long.make(123);
    const n = RcPtr!long.init;

    assert(a <= a);
    assert(a >= a);

    assert((a < b) == !(a >= b));
    assert((a > b) == !(a <= b));

    assert(a > n);
    assert(a > null);

    assert(n < a);
    assert(null < a);
}

{
    const a = RcPtr!long.make(42);
    const b = RcPtr!long.make(123);

    assert(a <= a.element);
    assert(a.element >= a);

    assert((a < b.element) == !(a.element >= b));
    assert((a > b.element) == !(a.element <= b));
}

Meta