Template variable not reach at compile

Greatsam4sure greatsam4sure at gmail.com
Sat Jul 21 12:15:23 UTC 2018


auto arithmetic(T, V, U)(T a,  V b,  U op){
    return mixin("a"~op~"b");
}

//call like this
arithmetic(1.5,2.5,"op");


Compiler says the variable op is not reach at compile time.  So 
how can the varible a and b be reach at compile time and op is 
not reach. I will appreciate any help. I have also use a static 
if but the same complain.  Just a newbie in D


More information about the Digitalmars-d-learn mailing list