float price; if (price == float.nan) { // initialized } else { // uninitialized } ... valid ?

someone someone at somewhere.com
Wed Jun 30 04:05:50 UTC 2021


On Wednesday, 30 June 2021 at 03:55:05 UTC, Vladimir Panteleev 
wrote:

> If you want to give any type a "null" value, you could use
[`std.typecons.Nullable`](https://dlang.org/library/std/typecons/nullable.html).

Practically Nullable!T stores a T and a bool.

I like the idea :)



More information about the Digitalmars-d-learn mailing list