template and constraints
bioinfornatics
bioinfornatics at fedoraproject.org
Mon Aug 20 14:52:03 PDT 2012
I got a little problem with these code:
____________________
double div(T a, U b)() if( a > 0 && b > 0 ){ // not works T and U unknwn
identifier
return a / b;
}
double div(T,U)(T a, U b) if( a > 0 && b > 0 ){ // not works, a and b
not known at compile time
return a / b;
}
double div(double a, double b)() if( a > 0 && b > 0 ){ // works but not
generic
return a / b;
}
_____________________
The only one who works is a not generic! they are a way? or i need to
write for each parameter type?
More information about the Digitalmars-d-learn
mailing list