overloading between templates and non-templates

#ponce cont4ct at gamesfr0mmar5.fr
Tue Dec 14 10:17:11 PST 2010


In D2 :


1/ Is it valid to have two functions with the same name, one templated and another not ? I remember a NG thread but cannot find it.

void A(int x) { // blah }
void A(T)(T x) { // blah }

2/ If (1)'s answer is yes, is it equivalent to a template specialization?

void A(int x) { // blah }
void A(T)(T x) { // blah }

A(x); // first function called

3/ If (2)'s answer is no, how is overloading resolved with :

void A(int x) { // blah }
void A(T)(T x) if (is(T== int)) { // blah }

A(x); // which function called ?

Many thanks.



More information about the Digitalmars-d-learn mailing list