digitalmars.D.learn - overloading between templates and non-templates
- #ponce (13/13) Dec 14 2010 In D2 :
- Steven Schveighoffer (8/12) Dec 14 2010 Yes, but it's not properly implemented. The ability is specified in TDP...
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.
Dec 14 2010
On Tue, 14 Dec 2010 13:17:11 -0500, #ponce <cont4ct gamesfr0mmar5.fr> wrote: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.Yes, but it's not properly implemented. The ability is specified in TDPL. There is a bug somewhere I think.2/ If (1)'s answer is yes, is it equivalent to a template specialization?I would have to guess yes (the opposite makes no sense), but I'm unsure of the full semantics (don't have a copy of TDPL). What's unclear to me is if the argument implicitly converts what is chosen. -Steve
Dec 14 2010








"Steven Schveighoffer" <schveiguy yahoo.com>