What is the rationale behind enabling Nullable!T to be used as a regular T?

Adnan relay.public.adnan at outlook.com
Fri Feb 14 12:40:54 UTC 2020


On Friday, 14 February 2020 at 10:35:52 UTC, DanielG wrote:
> There's also the 'optional' package if you're looking for 
> something more functional-program-ey:
>
> https://code.dlang.org/packages/optional

Not sure if this is any better

/+dub.sdl:
dependency "optional" version="~>1.0.0"
+/
import optional;

void main(const string[] args) {
     static import std;
     const auto n = no!int();
     std.writeln(n + 4); // []
}


More information about the Digitalmars-d mailing list