Nullable instantiator anyone?

bearophile via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Aug 17 11:51:37 PDT 2014


Nordlöw:

> I'm missing an instantiator function for std.typecons:Nullable. 
> Is this is intentional? If not, is this
>
> Nullable!T nullable(T)(T a)
> {
>     return typeof(return)(a);
> }
>
> sufficient for our needs?

It could be sufficient, but note that in Phobos there are two 
different versions of Nullable, one of them doesn't require extra 
memory, it uses one value as the "null" value.

Bye,
bearophile


More information about the Digitalmars-d-learn mailing list