Adding the ?. null verification
Etienne via Digitalmars-d
digitalmars-d at puremagic.com
Wed Jun 18 12:46:40 PDT 2014
> This also allows you to do a complete null check in a single statement:
>
> if (maybe(tree).left.right.right.left.right !is null) {
> // do something with that value
> }
>
> If nothing else, this at least saves you the trouble of having to check
> every intermediate reference in the chain. :)
>
Very clever, this should go straight to std.typecons. I'm definitely
ripping it for my project, if you can just scratch something like a
boost license on it ;)
More information about the Digitalmars-d
mailing list