Nullable!T

Adam Ruppe destructionator at gmail.com
Tue Jul 6 08:01:20 PDT 2010


On 7/6/10, bearophile <bearophileHUGS at lycos.com> wrote:
> I don't think that's a good idea, you lose the standard API of Nullable, so
> it's worse than useless.

Make that standard API free functions, like std.array does. Then, it
would work with all nullable items, and not just Nullable ones.
Uniformity is good.

>(and don't add a boolean after the T, using the null
> reference to store the missing T).

This would be the next best thing. struct Nullable(T) { T value; alias
value this; mixin standardApi!(this); } could do it.


More information about the Digitalmars-d mailing list