Nullable.opEquals

If they are both null, then they are equal. If one is null and the other is not, then they are not equal. If they are both non-null, then they are equal if their values are equal.

  1. bool opEquals(const(typeof(this)) rhs)
    struct Nullable(T)
    const
    bool
    opEquals
    ()
    (
    auto ref const(typeof(this)) rhs
    )
  2. bool opEquals(const(U) rhs)

Examples

Nullable!int empty;
Nullable!int a = 42;
Nullable!int b = 42;
Nullable!int c = 27;

assert(empty == empty);
assert(empty == Nullable!int.init);
assert(empty != a);
assert(empty != b);
assert(empty != c);

assert(a == b);
assert(a != c);

assert(empty != 42);
assert(a == 42);
assert(c != 42);

Meta