Solution to "statement is not reachable" depending on template variables?

Johan Engelen via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Wed Mar 16 10:08:20 PDT 2016


On Wednesday, 16 March 2016 at 11:47:35 UTC, QAston wrote:
> 
> import std.meta;
> template isBool(U)() = is(U == bool);
> static if (!allSatisfy!(isBool, T)) {
>     return true;  // no longer emits a warning
> }
>
> Something like this should work.

Thanks, but:

On Wednesday, 16 March 2016 at 11:18:36 UTC, Johan Engelen wrote:
> (I have heavily simplified the real-world code, please don't 
> discuss alternative solutions to the "is(U==bool)" in 
> particular. For sake of argument, assume that the predicate is 
> a complicated beast.)



More information about the Digitalmars-d-learn mailing list