Nullable!T

Jacob Carlborg doob at me.com
Wed Jul 7 04:59:37 PDT 2010


On 2010-07-06 17.01, Adam Ruppe wrote:
> 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.

Uniform function call syntax isn't implemented (issue 3382), if you're 
referring to that.

>> (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.


-- 
Jacob Carlborg


More information about the Digitalmars-d mailing list