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.
Not true:
immutable y = 1;
enum x = &y;
You can even do pointer arithmetics:
auto foo() {
auto x = [1,2,3,4];
auto y = &x[1];
return y[2];
}
pragma(msg, foo());