Optional.opEquals

Compare two optionals or an optional with some value

  1. bool opEquals(None )
  2. bool opEquals(Optional!U rhs)
  3. bool opEquals(U rhs)
    struct Optional(T)
    const
    bool
    opEquals
    (
    U : T
    )
    (
    const auto ref U rhs
    )
  4. bool opEquals(R other)

Return Value

Type: bool

- If the two are optionals then they are both unwrapped and compared. If either are empty this returns false. And if compared with none and there's a value, also returns false

auto a = some(3);
a == some(2); // false
a == some(3); // true
a == none; // false

Meta