How does this work?
ketmar via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Nov 23 15:27:26 PST 2014
On Sun, 23 Nov 2014 22:51:48 +0000
Freddy via Digitalmars-d-learn <digitalmars-d-learn at 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. ;-)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20141124/15f83eae/attachment.sig>
More information about the Digitalmars-d-learn
mailing list