View source code
Display the source code in std/typecons.d from which this
page was generated on github.
Report a bug
If you spot a problem with this page, click here to create a
Bugzilla issue.
Improve this page
Quickly fork, edit online, and submit a pull request for this page.
Requires a signed-in GitHub account. This works well for small changes.
If you'd like to make larger changes you may want to consider using
local clone.
Function std.typecons.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.
bool opEquals(This, Rhs)
(
auto ref Rhs rhs
)
if (!is(CommonType!(This, Rhs) == void));
bool opEquals(This, Rhs)
(
auto ref Rhs rhs
)
if (is(CommonType!(This, Rhs) == void) && is(typeof(this .get == rhs)));
Example
Nullable!int empty;
Nullable!int a = 42;
Nullable!int b = 42;
Nullable!int c = 27;
writeln(empty); // empty
writeln(empty); // Nullable!int.init
assert(empty != a);
assert(empty != b);
assert(empty != c);
writeln(a); // b
assert(a != c);
assert(empty != 42);
writeln(a); // 42
assert(c != 42);
Authors
Andrei Alexandrescu, Bartosz Milewski, Don Clugston, Shin Fujishiro, Kenji Hara
License
Copyright © 1999-2024 by the D Language Foundation | Page generated by ddox.