The problem with the value that is returned from the condition in `static if`. Bug or feature?

lobo via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sat Jun 6 20:04:36 PDT 2015


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.



More information about the Digitalmars-d-learn mailing list