"if" is not evaluated for fields of Class.tupleof

ag0aep6g via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri May 19 06:53:56 PDT 2017


On 05/19/2017 03:46 PM, Timoses wrote:
>          foreach (field; fields)
>          {
>              // Here it should actually not enter when field is mbyte 
> (byte)
>              if (isStaticArray!(typeof(field)))

You probably want `static if` here.

With normal `if`, the body still gets compiled, even if the condition is 
compile-time constant false. With `static if`, the body is skipped.


More information about the Digitalmars-d-learn mailing list