digitalmars.D.learn - How does this work?
- Freddy (5/5) Nov 23 2014 I know what this does, but can someone explain how it works?
- ketmar via Digitalmars-d-learn (11/17) Nov 23 2014 On Sun, 23 Nov 2014 22:51:48 +0000
I know what this does, but can someone explain how it works? ---- static if((typeof((inout int=0){ }))); ----
Nov 23 2014
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=3D0){ =20 }))); ----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. ;-)
Nov 23 2014