Extending library functions

tn no at email.com
Thu Oct 18 04:31:43 PDT 2012


Hi.

I want to extend math library functions to work with my own type. 
However, the definition for my own type seems to prevent 
automated access to the original function. How can I fix this 
unexpected behavior?

Simplified example:
--------------------
import std.math;

int exp2(int x) {
     return 1 >> x;
}

void main() {
     assert(exp2(0.0) == 1.0);              // <= why does not 
this work anymore?
     //assert(std.math.exp2(0.0) == 1.0);   // <= this works
}
--------------------



More information about the Digitalmars-d-learn mailing list