Solution to "statement is not reachable" depending on template variables?
Steven Schveighoffer via Digitalmars-d-learn
digitalmars-d-learn at puremagic.com
Sun Jun 18 09:00:27 PDT 2017
On Sunday, 18 June 2017 at 11:11:59 UTC, Johan Engelen wrote:
> On Sunday, 18 June 2017 at 09:56:50 UTC, Steven Schveighoffer
> wrote:
>> On Sunday, 18 June 2017 at 09:28:57 UTC, Johan Engelen wrote:
>>> Reviving this thread to see whether anything has changed on
>>> the topic.
>>>
>>
>> If Timon gets static for each into the language, it can look a
>> little better.
>
> Can you help me understand what you mean? How will it improve
> things? (static foreach would disable the "statement not
> reachable" analysis?)
>
> -Johan
On my phone so can't be too detailed, but you could do:
static foreach(i; 0..seq.length+1)
static if(seq.length == i)
return true;
else static if(is(seq[i] == bool))
return false;
Maybe looks a little better than the first workaround.
-Steve
More information about the Digitalmars-d-learn
mailing list