Templates: generic "return null;"

Chris wendlec at tcd.ie
Mon Feb 3 06:23:37 PST 2014


On Monday, 3 February 2014 at 14:21:29 UTC, Dicebot wrote:
> On Monday, 3 February 2014 at 14:17:11 UTC, Chris wrote:
>> Probably. I tried using Nullable, but it caused some problems 
>> when the attribute wasn't defined:
>>
>> core.exception.AssertError@/usr/include/dmd/phobos/std/typecons.d(1233): 
>> Called `get' on null Nullable!int.
>
> This is intended. The very point of Nullable is to force you to 
> handle `null` state before accessing actual payload.

Aha, I see. So in my scenario it is useless.


More information about the Digitalmars-d-learn mailing list