Overload sets and templates
Nick Sabalausky
SeeWebsiteToContactMe at semitwist.com
Sat Feb 8 01:46:54 PST 2014
This works:
------------------------------
void foo(T)(T t) if(is(T==char)) {}
void foo(T)(T t) if(is(T==int )) {}
void main() { foo(1); }
------------------------------
But if I move the "int" version to a different module, and try to alias
it into the current module's overload set (like I can with non-templated
functions), I just get an error that the "char" version of foo conflicts
with the alias:
------------------------------
module a;
import b;
alias foo = b.foo;
void foo(T)(T t) if(is(T==char)) {}
void main() { foo(1); }
------------------------------
module b;
void foo(T)(T t) if(is(T==int)) {}
------------------------------
What's up with that? Is there a way to do it?
More information about the Digitalmars-d-learn
mailing list