Function Option.opEquals

Compares this Option with that.

bool opEquals(U) (
  auto const ref U that
) const
if (is(U == Option));

bool opEquals(U) (
  auto const ref U that
) const
if (ifTestable!(U, (a) => a == T.init) && !is(U == Option));

If both objects are options of the same type and they don't contain a value, they are considered equal. If only one of them contains a value, they aren't equal. Otherwise, the encapsulated values are compared for equality.

If U is a type comparable with the type encapsulated by this Option, the value of this Option is compared with that, this Option must have a value then.

Parameters

NameDescription
U Type of the object to compare with.
that Object to compare with.

Returns

true if this Option and that are equal, false if not.

Precondition

!isNothing if U is equality comparable with T.