Templates: generic "return null;"

Chris wendlec at tcd.ie
Mon Feb 3 06:17:10 PST 2014


On Monday, 3 February 2014 at 14:10:35 UTC, bearophile wrote:
> Dicebot:
>
>> If you need cheap and simple way to figure out that attribute 
>> was missing, change API to return value by out parameter and 
>> turn normal return value into boolean success flag.
>
> It's probably better to start using Nullable.
>
> Bye,
> bearophile

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.


More information about the Digitalmars-d-learn mailing list