November 23, 2014 How does this work? | ||||
---|---|---|---|---|
| ||||
I know what this does, but can someone explain how it works? ---- static if((typeof((inout int=0){ }))); ---- |
November 23, 2014 Re: How does this work? | ||||
---|---|---|---|---|
| ||||
Posted in reply to Freddy Attachments: | On Sun, 23 Nov 2014 22:51:48 +0000 Freddy via Digitalmars-d-learn <digitalmars-d-learn@puremagic.com> wrote: > I know what this does, but can someone explain how it works? > ---- > static if((typeof((inout int=0){ > > }))); > ---- it was here somewhere. this is, as you can see, a lambda. `typeof()` can be used even for invalid code and will return special `error` type (don't try to catch it, just trust me ;-). in `static if` this `error` type means `false`. labmda that can not be compiled is obvious invalid, uncompilable code, so it has a type of `error`. and `inout` is a hack for some kind of functions/templates. to make a long story short: don't try to remember it all, you'll forget it next day. just take it as it is and be happy. ;-) |
Copyright © 1999-2021 by the D Language Foundation