Comparison of struct with Nullable member
TC via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Fri Jul 17 08:52:43 PDT 2015
On Friday, 17 July 2015 at 15:30:42 UTC, Meta wrote:
> https://issues.dlang.org/show_bug.cgi?id=14804
>
> I'll probably be able to submit a PR for this sometime in the
> next few days.
Thanks.
What I don't get is why this one works ok?
import std.typecons : Nullable;
struct Foo
{
int bar;
Nullable!int baz;
}
auto a = Foo(1);
auto b = Foo(1);
assert(a == b);
Also is there some "nicer" way to init the struct with nullable
member with default constructor?
Now I'm using Foo(1, Nullable!int(2)) but just Foo(1, 2) would be
much nicer.
Same with calling functions with nullable params.
More information about the Digitalmars-d-learn
mailing list