On Sunday, 7 June 2015 at 03:04:38 UTC, lobo wrote:
On Sunday, 7 June 2015 at 03:01:15 UTC, lobo wrote:
On Saturday, 6 June 2015 at 17:06:37 UTC, Dennis Ritchie wrote:
[snip]

`static if(5 in hash) {}` will not work because (5 in hash) returns a pointer to the value or null if the key oesn't exist.

bye,
lobo

just to be clear, you cannot have a pointer to anything at compile time because it doesn't exist and IMO changing 'in' to behave differently for static-if compared runtime if would be bad.

This, of course, it is logical, but it somehow works:

immutable hash = [1 : 3, 5 : 7];

static if (!!(5 in hash))
    writeln("OK"); // prints OK

Reply via email to